增加网络请求日志
This commit is contained in:
parent
1348d2899c
commit
de35a605a7
@ -107,6 +107,9 @@ public class HttpLoggingInterceptor implements Interceptor {
|
||||
String name = headers.name(i);
|
||||
// Skip headers from the request body as they are explicitly logged above.
|
||||
if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Length".equalsIgnoreCase(name)) {
|
||||
if (i == 0){
|
||||
log("请求头:");
|
||||
}
|
||||
log("\t" + name + ": " + headers.value(i));
|
||||
}
|
||||
}
|
||||
@ -114,6 +117,7 @@ public class HttpLoggingInterceptor implements Interceptor {
|
||||
log(" ");
|
||||
if (logBody && hasRequestBody) {
|
||||
if (isPlaintext(requestBody.contentType())) {
|
||||
log("request Body :");
|
||||
bodyToString(request);
|
||||
} else {
|
||||
log("\tbody: maybe [binary body], omitted!");
|
||||
|
Loading…
Reference in New Issue
Block a user