Created
April 6, 2019 07:52
-
-
Save Lavanyagaur22/92f585d3d4d0d5cbc4943cbcdfdca435 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
private fun getOkhttpClient(context: Context): OkHttpClient? { | |
//Adding HttpLoggingInterceptor() to see the response body and the results. | |
val loggingInterceptor = HttpLoggingInterceptor() | |
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY | |
httpClient?.let { | |
return it | |
} ?: kotlin.run { | |
httpClient = OkHttpClient.Builder() | |
.addInterceptor(loggingInterceptor) | |
.addInterceptor(getConflictInterceptor(context)!!) | |
.build() | |
} | |
return httpClient | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment