Skip to content

Instantly share code, notes, and snippets.

@freaksgit
Created July 19, 2018 10:54
Show Gist options
  • Save freaksgit/917107644627f3550e56029893729b4a to your computer and use it in GitHub Desktop.
Save freaksgit/917107644627f3550e56029893729b4a to your computer and use it in GitHub Desktop.
OkHttp3 interceptor
public class HttpInter implements Interceptor{
@Override
public Response intercept(Chain chain) throws IOException {
if (internet.isAvailable()){
return chain.proceed(chain.request());
} else {
throw new IOException(new InternetUnavailableException("No internet connection."));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment