Skip to content

Commit 620ecd0

Browse files
committed
bug fix. net work logger block communications [#85]
- 네트워크 로그가 `body.source()`, `body.bytes()` 호출하면서 네트워크 호출 자체를 block 하는 이슈 해결
1 parent 7d7e475 commit 620ecd0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

util/src/main/java/com/foke/together/util/retrofit/NetworkCall.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.foke.together.util.retrofit
33
import com.foke.together.util.AppLog
44
import com.foke.together.util.AppPolicy
55
import okhttp3.Request
6-
import okhttp3.ResponseBody
76
import okio.IOException
87
import okio.Timeout
98
import retrofit2.Call
@@ -17,15 +16,14 @@ class NetworkCall<T>(
1716
call.enqueue(object: Callback<T> {
1817
override fun onResponse(call: Call<T>, response: Response<T>) {
1918
if (AppPolicy.isDebugMode) {
20-
AppLog.e(TAG, "onResponse", "success: $response")
21-
AppLog.e(TAG, "onResponse", "success: ${response.headers()}")
22-
23-
val body = response.body() as ResponseBody
24-
AppLog.e(TAG, "onResponse", "success: ${response.body()}")
25-
AppLog.e(TAG, "onResponse", "success: ${body.source()}")
26-
AppLog.e(TAG, "onResponse", "success: ${body.contentLength()}")
27-
AppLog.e(TAG, "onResponse", "success: ${body.contentType()}")
28-
AppLog.e(TAG, "onResponse", "success: ${body.bytes()}")
19+
AppLog.e(TAG, "onResponse", ">>>>>>>>>>>>>>>>> start >>>>>>>>>>>>>>>>>")
20+
AppLog.e(TAG, "onResponse", "response: $response")
21+
AppLog.e(TAG, "onResponse", "headers: ${response.headers()}")
22+
response.raw().body?.run {
23+
AppLog.e(TAG, "onResponse", "contentType: ${this.contentType()}")
24+
AppLog.e(TAG, "onResponse", "contentLength: ${this.contentLength()}")
25+
}
26+
AppLog.e(TAG, "onResponse", "<<<<<<<<<<<<<<<<<< end <<<<<<<<<<<<<<<<")
2927
}
3028

3129
if (response.isSuccessful) {

0 commit comments

Comments
 (0)