use of okhttp3.HttpUrl in project pivotal-cla by pivotalsoftware.
the class EnqueueResourcesMockWebServerITest method contentType.
@Test
public void contentType() throws IOException {
OkHttpClient client = new OkHttpClient.Builder().build();
HttpUrl url = server.getServer().url("/");
Request request = new Request.Builder().get().url(url).build();
Response response = client.newCall(request).execute();
assertEquals("application/json", response.headers().get("Content-Type"));
assertEquals("{'message':'hi'}", response.body().string());
}
use of okhttp3.HttpUrl in project RxReddit by damien5314.
the class RawResponseInterceptor method intercept.
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
HttpUrl url = originalRequest.url().newBuilder().addQueryParameter("raw_json", "1").build();
Request newRequest = originalRequest.newBuilder().url(url).build();
return chain.proceed(newRequest);
}
use of okhttp3.HttpUrl in project TeamCityApp by vase4kin.
the class GuestUserAuthInterceptor method intercept.
/**
* {@inheritDoc}
*/
@Override
public Response intercept(Chain chain) throws IOException {
HttpUrl urlWithGuestSupport = chain.request().url().newBuilder().addQueryParameter(QUERY_PARAM, QUERY_VALUE).build();
Request requestWithGuestSupport = chain.request().newBuilder().url(urlWithGuestSupport).build();
return chain.proceed(requestWithGuestSupport);
}
use of okhttp3.HttpUrl in project drift-sdk-android by Driftt.
the class APIAuthTokenInterceptor method intercept.
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();
Auth auth = Auth.getInstance();
if (auth != null && auth.getAccessToken() != null) {
HttpUrl url = request.url().newBuilder().addQueryParameter("access_token", auth.getAccessToken()).build();
request = request.newBuilder().url(url).build();
}
return chain.proceed(request);
}
use of okhttp3.HttpUrl in project mapbox-events-android by mapbox.
the class MockWebServerTest method provideDefaultTelemetryClientSettings.
private TelemetryClientSettings provideDefaultTelemetryClientSettings() {
HttpUrl localUrl = obtainBaseEndpointUrl();
SslClient sslClient = SslClient.localhost();
return new TelemetryClientSettings.Builder().baseUrl(localUrl).sslSocketFactory(sslClient.socketFactory).x509TrustManager(sslClient.trustManager).hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
}).build();
}
Aggregations