mirror of
https://github.com/square/okhttp.git
synced 2025-11-27 18:21:14 +03:00
Log the full URL.
This commit is contained in:
@@ -17,7 +17,6 @@ package com.squareup.okhttp.logging;
|
||||
|
||||
import com.squareup.okhttp.Connection;
|
||||
import com.squareup.okhttp.Headers;
|
||||
import com.squareup.okhttp.HttpUrl;
|
||||
import com.squareup.okhttp.Interceptor;
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
@@ -148,7 +147,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
|
||||
Connection connection = chain.connection();
|
||||
Protocol protocol = connection != null ? connection.getProtocol() : Protocol.HTTP_1_1;
|
||||
String requestStartMessage =
|
||||
"--> " + request.method() + ' ' + requestPath(request.httpUrl()) + ' ' + protocol(protocol);
|
||||
"--> " + request.method() + ' ' + request.httpUrl() + ' ' + protocol(protocol);
|
||||
if (!logHeaders && hasRequestBody) {
|
||||
requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
|
||||
}
|
||||
@@ -237,10 +236,4 @@ public final class HttpLoggingInterceptor implements Interceptor {
|
||||
private static String protocol(Protocol protocol) {
|
||||
return protocol == Protocol.HTTP_1_0 ? "HTTP/1.0" : "HTTP/1.1";
|
||||
}
|
||||
|
||||
private static String requestPath(HttpUrl url) {
|
||||
String path = url.encodedPath();
|
||||
String query = url.encodedQuery();
|
||||
return query != null ? (path + '?' + query) : path;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user