Skip to content

Instantly share code, notes, and snippets.

@TheLester
Created February 25, 2016 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheLester/58f1b787832178648de2 to your computer and use it in GitHub Desktop.
Save TheLester/58f1b787832178648de2 to your computer and use it in GitHub Desktop.
final Interceptor unauthorizedErrorInterceptor = new Interceptor() {
@Override public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
boolean unAuthorized = (response.code() == 401);
if (unAuthorized) {
EventBus.getDefault().post(new EventsHolder.RequestWithInvalidTokenEvent());
}
return response;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment