@Test public void testGetClientIdInterceptor() throws IOException { String clientId = "test-client-id"; MockWebServer webServer = new MockWebServer(); webServer.enqueue(new MockResponse()); webServer.start(); HttpUrl url = webServer.url("/"); Interceptor clientIdInterceptor = Sixpack.getClientIdInterceptor(clientId); assertNotNull(clientIdInterceptor); OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(clientIdInterceptor) .build(); Response response = client.newCall(new Request.Builder().url(url).build()).execute(); assertEquals(clientId, response.request().url().queryParameter("client_id")); }
static Interceptor getClientIdInterceptor(final String clientId) { return new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { final Request request = chain.request(); final Request.Builder builder = request.newBuilder() .url(request.url().newBuilder().addQueryParameter("client_id", clientId).build()); return chain.proceed(builder.build()); } }; }
Sixpack { static Interceptor getClientIdInterceptor(final String clientId) { return new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { final Request request = chain.request(); final Request.Builder builder = request.newBuilder() .url(request.url().newBuilder().addQueryParameter("client_id", clientId).build()); return chain.proceed(builder.build()); } }; } }
Sixpack { static Interceptor getClientIdInterceptor(final String clientId) { return new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { final Request request = chain.request(); final Request.Builder builder = request.newBuilder() .url(request.url().newBuilder().addQueryParameter("client_id", clientId).build()); return chain.proceed(builder.build()); } }; } Sixpack(final HttpUrl sixpackUrl, final String clientId, final OkHttpClient client);   Sixpack(final SixpackApi api);   Sixpack(final SixpackApi api, final String clientId); }
Sixpack { static Interceptor getClientIdInterceptor(final String clientId) { return new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { final Request request = chain.request(); final Request.Builder builder = request.newBuilder() .url(request.url().newBuilder().addQueryParameter("client_id", clientId).build()); return chain.proceed(builder.build()); } }; } Sixpack(final HttpUrl sixpackUrl, final String clientId, final OkHttpClient client);   Sixpack(final SixpackApi api);   Sixpack(final SixpackApi api, final String clientId); ExperimentBuilder experiment(); String getClientId(); void setLogLevel(LogLevel logLevel); LogLevel getLogLevel(); void setLogger(final Logger logger); static String generateRandomClientId(); }
Sixpack { static Interceptor getClientIdInterceptor(final String clientId) { return new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { final Request request = chain.request(); final Request.Builder builder = request.newBuilder() .url(request.url().newBuilder().addQueryParameter("client_id", clientId).build()); return chain.proceed(builder.build()); } }; } Sixpack(final HttpUrl sixpackUrl, final String clientId, final OkHttpClient client);   Sixpack(final SixpackApi api);   Sixpack(final SixpackApi api, final String clientId); ExperimentBuilder experiment(); String getClientId(); void setLogLevel(LogLevel logLevel); LogLevel getLogLevel(); void setLogger(final Logger logger); static String generateRandomClientId(); static final HttpUrl DEFAULT_URL; static final String NAME_REGEX; static final Pattern NAME_PATTERN; static final LogLevel DEFAULT_LOG_LEVEL; static final String SIXPACK_LOG_TAG; }