Created
May 1, 2019 18:15
-
-
Save dinorahto/285b0b5d523bd908ac33a685ee12b4dc to your computer and use it in GitHub Desktop.
Extending Interceptor for HTTP request
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
/** | |
* Created by Dinorah Tovar on 04/04/18. | |
* Secondary helper interceptor to skip interceptor headers over Data Module | |
*/ | |
class SupportInterceptor: Interceptor { | |
/** | |
* Interceptor class for setting of the headers for every request | |
*/ | |
override fun intercept(chain: Interceptor.Chain): Response { | |
var request = chain.request() | |
request = request?.newBuilder() | |
?.addHeader("Content-Type", "application/json") | |
?.addHeader("Accept", "application/json") | |
?.build() | |
return chain.proceed(request) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment