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