Created
July 19, 2018 10:54
-
-
Save freaksgit/917107644627f3550e56029893729b4a to your computer and use it in GitHub Desktop.
OkHttp3 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 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