mirror of
https://github.com/square/okhttp.git
synced 2025-11-24 18:41:06 +03:00
Cleanup HttpLoggingInterceptor (#4346)
* Use try-with-resources
* Make bodyHasUnknownEncoding() static
* Fix nits in HttpLoggingInterceptorTest
* Revert "Use try-with-resources"
This reverts commit 57dcd61a9e.
This commit is contained in:
committed by
Jesse Wilson
parent
ef34a41d09
commit
1f7e796e6e
@@ -326,7 +326,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean bodyHasUnknownEncoding(Headers headers) {
|
||||
private static boolean bodyHasUnknownEncoding(Headers headers) {
|
||||
String contentEncoding = headers.get("Content-Encoding");
|
||||
return contentEncoding != null
|
||||
&& !contentEncoding.equalsIgnoreCase("identity")
|
||||
|
||||
@@ -59,8 +59,8 @@ public final class HttpLoggingInterceptorTest {
|
||||
|
||||
@Rule public final MockWebServer server = new MockWebServer();
|
||||
|
||||
private HandshakeCertificates handshakeCertificates = localhost();
|
||||
private HostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();
|
||||
private final HandshakeCertificates handshakeCertificates = localhost();
|
||||
private final HostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();
|
||||
private OkHttpClient client;
|
||||
private String host;
|
||||
private HttpUrl url;
|
||||
@@ -650,7 +650,7 @@ public final class HttpLoggingInterceptorTest {
|
||||
.assertNoMoreLogs();
|
||||
}
|
||||
|
||||
@Test public void isPlaintext() throws IOException {
|
||||
@Test public void isPlaintext() {
|
||||
assertTrue(HttpLoggingInterceptor.isPlaintext(new Buffer()));
|
||||
assertTrue(HttpLoggingInterceptor.isPlaintext(new Buffer().writeUtf8("abc")));
|
||||
assertTrue(HttpLoggingInterceptor.isPlaintext(new Buffer().writeUtf8("new\r\nlines")));
|
||||
|
||||
Reference in New Issue
Block a user