Created
May 1, 2019 18:12
-
-
Save dinorahto/674d8ac2b6b66945283d92863f6bbc50 to your computer and use it in GitHub Desktop.
Interceptor Autheticator OkhttpClient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* OkHttpClient | |
*/ | |
@Provides | |
@Singleton | |
fun getUnsafeOkHttpClient(): OkHttpClient { | |
val interceptor = HttpLoggingInterceptor() | |
interceptor.level = HttpLoggingInterceptor.Level.HEADERS | |
interceptor.level = HttpLoggingInterceptor.Level.BODY | |
val builder = OkHttpClient.Builder() | |
builder.addInterceptor(interceptor) | |
.connectTimeout(20, TimeUnit.SECONDS) | |
.readTimeout(20, TimeUnit.SECONDS) | |
.addInterceptor(SupportInterceptor()) | |
.authenticator(SupportInterceptor()) | |
return builder.build() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment