Skip to content

Tag: okhttp3

Create OkHttp3 Response for testing

Use a variation of the following code to create a Response to test with: private Response createResponse() { HttpUrl mHttpUrl = new HttpUrl.Builder() .scheme(“https”) .host(“example.com”) .build(); Request mRequest = new Request.Builder() .url(mHttpUrl) .build(); Response.Builder builder = new Response.Builder() .request(mRequest) .protocol(Protocol.HTTP_1_1) .message(“message”) .code(302); return builder.build(); }…

Continue reading Create OkHttp3 Response for testing