Search in sources :

Example 6 with StethoInterceptor

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();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) StethoInterceptor(com.facebook.stetho.okhttp3.StethoInterceptor) HttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

StethoInterceptor (com.facebook.stetho.okhttp3.StethoInterceptor)6 OkHttpClient (okhttp3.OkHttpClient)5 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)5 Provides (dagger.Provides)3 Singleton (javax.inject.Singleton)3 File (java.io.File)2 Cache (okhttp3.Cache)2 ImagePipelineConfig (com.facebook.imagepipeline.core.ImagePipelineConfig)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 CookieManger (com.rogrand.demo.http.cookie.CookieManger)1 PersistentCookieStore (com.zimincom.mafiaonline.PersistentCookieStore)1 CacheControl (okhttp3.CacheControl)1 ConnectionPool (okhttp3.ConnectionPool)1 Interceptor (okhttp3.Interceptor)1 Request (okhttp3.Request)1 Response (okhttp3.Response)1 JavaNetCookieJar (okhttp3.internal.JavaNetCookieJar)1 Retrofit (retrofit2.Retrofit)1