Last active
August 22, 2018 08:44
-
-
Save voghDev/35c79194ecc85e1cb95738b60d9b4b1c to your computer and use it in GitHub Desktop.
Retrofit2 interceptor to add headers to HTTP requests
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
public class AddHeaderInterceptor implements Interceptor { | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
Request.Builder builder = chain.request().newBuilder(); | |
builder.addHeader("Authorization", "headerContent"); | |
return chain.proceed(builder.build()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the difference between addNetworkInterpector() and addInterceptor() ?