use of com.facebook.stetho.okhttp3.StethoInterceptor in project coins-android by bubelov.
the class MainModule method httpClient.
@Provides
@Singleton
OkHttpClient httpClient() {
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS).readTimeout(30, TimeUnit.SECONDS).writeTimeout(30, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
httpClientBuilder.addInterceptor(loggingInterceptor);
httpClientBuilder.addNetworkInterceptor(new StethoInterceptor());
}
return httpClientBuilder.build();
}
Aggregations