Created
July 19, 2018 17:15
-
-
Save dinorahtovar/3144797913484286a6c530e947cb9383 to your computer and use it in GitHub Desktop.
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
@Provides | |
@Singleton | |
fun getUnsafeOkHttpClient(): OkHttpClient { | |
val interceptor = HttpLoggingInterceptor() | |
interceptor.level = HttpLoggingInterceptor.Level.BODY | |
val builder = OkHttpClient.Builder() | |
builder.addInterceptor(interceptor) | |
.connectTimeout(30, TimeUnit.SECONDS) | |
.readTimeout(30, TimeUnit.SECONDS) | |
.followRedirects(true) | |
.followSslRedirects(true) | |
.addInterceptor { chain -> | |
val newRequest = chain.request().newBuilder() | |
.addHeader("Authorization", UUID.randomUUID().toString()) | |
.build() | |
chain.proceed(newRequest) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment