1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-01 16:06:56 +03:00

Extension Functions toRequestBody(), toResponseBody()

This commit is contained in:
Jesse Wilson
2019-05-25 13:50:28 -04:00
parent bd9ff70d6c
commit 8bb58332db
26 changed files with 270 additions and 168 deletions

View File

@ -140,7 +140,7 @@ public final class HttpLoggingInterceptorTest {
setLevel(Level.BASIC);
server.enqueue(new MockResponse());
client.newCall(request().post(RequestBody.create(PLAIN, "Hi?")).build()).execute();
client.newCall(request().post(RequestBody.create("Hi?", PLAIN)).build()).execute();
applicationLogs
.assertLogEqual("--> POST " + url + " (3-byte body)")
@ -225,7 +225,7 @@ public final class HttpLoggingInterceptorTest {
setLevel(Level.HEADERS);
server.enqueue(new MockResponse());
Request request = request().post(RequestBody.create(PLAIN, "Hi?")).build();
Request request = request().post(RequestBody.create("Hi?", PLAIN)).build();
Response response = client.newCall(request).execute();
response.body().close();
@ -258,7 +258,7 @@ public final class HttpLoggingInterceptorTest {
setLevel(Level.HEADERS);
server.enqueue(new MockResponse());
Request request = request().post(RequestBody.create(null, "Hi?")).build();
Request request = request().post(RequestBody.create("Hi?", null)).build();
Response response = client.newCall(request).execute();
response.body().close();
@ -426,7 +426,7 @@ public final class HttpLoggingInterceptorTest {
setLevel(Level.BODY);
server.enqueue(new MockResponse());
Request request = request().post(RequestBody.create(PLAIN, "Hi?")).build();
Request request = request().post(RequestBody.create("Hi?", PLAIN)).build();
Response response = client.newCall(request).execute();
response.body().close();

View File

@ -101,7 +101,7 @@ public final class LoggingEventListenerTest {
@Test
public void post() throws IOException {
server.enqueue(new MockResponse());
client.newCall(request().post(RequestBody.create(PLAIN, "Hello!")).build()).execute();
client.newCall(request().post(RequestBody.create("Hello!", PLAIN)).build()).execute();
logRecorder
.assertLogMatch("callStart: Request\\{method=POST, url=" + url + ", tags=\\{\\}\\}")