Skip to content

Commit

Permalink
bug fix. net work logger block communications [#85]
Browse files Browse the repository at this point in the history
- 네트워크 로그가 `body.source()`, `body.bytes()` 호출하면서 네트워크 호출 자체를 block 하는 이슈 해결
  • Loading branch information
DokySp committed Oct 11, 2024
1 parent 7d7e475 commit 0aab180
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions util/src/main/java/com/foke/together/util/retrofit/NetworkCall.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.foke.together.util.retrofit
import com.foke.together.util.AppLog
import com.foke.together.util.AppPolicy
import okhttp3.Request
import okhttp3.ResponseBody
import okio.IOException
import okio.Timeout
import retrofit2.Call
Expand All @@ -17,15 +16,14 @@ class NetworkCall<T>(
call.enqueue(object: Callback<T> {
override fun onResponse(call: Call<T>, response: Response<T>) {
if (AppPolicy.isDebugMode) {
AppLog.e(TAG, "onResponse", "success: $response")
AppLog.e(TAG, "onResponse", "success: ${response.headers()}")

val body = response.body() as ResponseBody
AppLog.e(TAG, "onResponse", "success: ${response.body()}")
AppLog.e(TAG, "onResponse", "success: ${body.source()}")
AppLog.e(TAG, "onResponse", "success: ${body.contentLength()}")
AppLog.e(TAG, "onResponse", "success: ${body.contentType()}")
AppLog.e(TAG, "onResponse", "success: ${body.bytes()}")
AppLog.e(TAG, "onResponse", ">>>>>>>>>>>>>>>>> start >>>>>>>>>>>>>>>>>")
AppLog.e(TAG, "onResponse", "response: $response")
AppLog.e(TAG, "onResponse", "headers: ${response.headers()}")
response.raw().body?.run {
AppLog.e(TAG, "onResponse", "contentType: ${this.contentType()}")
AppLog.e(TAG, "onResponse", "contentLength: ${this.contentLength()}")
}
AppLog.e(TAG, "onResponse", "<<<<<<<<<<<<<<<<<< end <<<<<<<<<<<<<<<<")
}

if (response.isSuccessful) {
Expand Down

0 comments on commit 0aab180

Please sign in to comment.