Created
May 8, 2017 09:15
-
-
Save ngima/cc42c13167efcc1390f918031d879a96 to your computer and use it in GitHub Desktop.
Header Interceptor
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 HeaderInterceptor | |
implements Interceptor { | |
@Override | |
public Response intercept(Chain chain) | |
throws IOException { | |
Request request = chain.request(); | |
request = request.newBuilder() | |
.addHeader("appid", "hello") | |
.addHeader("deviceplatform", "android") | |
.removeHeader("User-Agent") | |
.addHeader("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0") | |
.build(); | |
Response response = chain.proceed(request); | |
return response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment