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

Beef up Request's toString

Previously it unconditionally showed tags even if empty and would not show headers.
This commit is contained in:
Jake Wharton
2019-05-24 21:57:46 -04:00
parent 31ec0c74cc
commit a0a3ef543c
2 changed files with 28 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ public final class LoggingEventListenerTest {
response.body().bytes();
logRecorder
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + ", tags=\\{\\}\\}")
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + "\\}")
.assertLogMatch("dnsStart: " + url.host())
.assertLogMatch("dnsEnd: \\[.+\\]")
.assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT")
@@ -104,7 +104,7 @@ public final class LoggingEventListenerTest {
client.newCall(request().post(RequestBody.create("Hello!", PLAIN)).build()).execute();
logRecorder
.assertLogMatch("callStart: Request\\{method=POST, url=" + url + ", tags=\\{\\}\\}")
.assertLogMatch("callStart: Request\\{method=POST, url=" + url + "\\}")
.assertLogMatch("dnsStart: " + url.host())
.assertLogMatch("dnsEnd: \\[.+\\]")
.assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT")
@@ -144,7 +144,7 @@ public final class LoggingEventListenerTest {
platform.assumeHttp2Support();
logRecorder
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + ", tags=\\{\\}\\}")
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + "\\}")
.assertLogMatch("dnsStart: " + url.host())
.assertLogMatch("dnsEnd: \\[.+\\]")
.assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT")
@@ -187,7 +187,7 @@ public final class LoggingEventListenerTest {
}
logRecorder
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + ", tags=\\{\\}\\}")
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + "\\}")
.assertLogMatch("dnsStart: " + url.host())
.assertLogMatch("callFailed: java.net.UnknownHostException: reason")
.assertNoMoreLogs();
@@ -207,7 +207,7 @@ public final class LoggingEventListenerTest {
}
logRecorder
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + ", tags=\\{\\}\\}")
.assertLogMatch("callStart: Request\\{method=GET, url=" + url + "\\}")
.assertLogMatch("dnsStart: " + url.host())
.assertLogMatch("dnsEnd: \\[.+\\]")
.assertLogMatch("connectStart: " + url.host() + "/.+ DIRECT")