Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit aa665a7

Browse files
committed
Show request headers and body properly
1 parent dc39475 commit aa665a7

File tree

1 file changed

+7
-4
lines changed
  • owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http

1 file changed

+7
-4
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/LogInterceptor.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
package com.owncloud.android.lib.common.http
2525

2626
import com.owncloud.android.lib.common.http.LogBuilder.logHttp
27-
import com.owncloud.android.lib.common.http.NetworkNode.*
28-
import com.owncloud.android.lib.common.http.NetworkPetition.*
27+
import com.owncloud.android.lib.common.http.NetworkNode.BODY
28+
import com.owncloud.android.lib.common.http.NetworkNode.HEADER
29+
import com.owncloud.android.lib.common.http.NetworkNode.INFO
30+
import com.owncloud.android.lib.common.http.NetworkPetition.REQUEST
31+
import com.owncloud.android.lib.common.http.NetworkPetition.RESPONSE
2932
import okhttp3.Interceptor
3033
import okhttp3.Response
3134

@@ -39,8 +42,8 @@ class LogInterceptor : Interceptor {
3942
if (httpLogsEnabled) {
4043
// Log request
4144
logHttp(REQUEST, INFO, "Type: ${it.request.method} URL: ${it.request.url}")
42-
it.headers.forEach { header -> logHttp(REQUEST, HEADER, header.toString()) }
43-
logHttp(REQUEST, BODY, it.body.toString())
45+
it.request.headers.forEach { header -> logHttp(REQUEST, HEADER, header.toString()) }
46+
logHttp(REQUEST, BODY, it.request.body.toString())
4447

4548
// Log response
4649
logHttp(RESPONSE, INFO, "Code: ${it.code} Message: ${it.message} IsSuccessful: ${it.isSuccessful}")

0 commit comments

Comments
 (0)