1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-27 18:21:14 +03:00

Support 204 and 205 'No Content' replies when application interceptor.

This commit is contained in:
Jake Wharton
2015-11-24 17:05:46 -05:00
parent 57d7367bba
commit b93104c9e6
2 changed files with 335 additions and 140 deletions

View File

@@ -27,6 +27,7 @@ import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import com.squareup.okhttp.ResponseBody;
import com.squareup.okhttp.internal.Platform;
import com.squareup.okhttp.internal.http.HttpEngine;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;
@@ -194,7 +195,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
}
String endMessage = "<-- END HTTP";
if (logBody) {
if (logBody && HttpEngine.hasBody(response)) {
BufferedSource source = responseBody.source();
source.request(Long.MAX_VALUE); // Buffer the entire body.
Buffer buffer = source.buffer();