2

Lets say we need to retry a request in case of exception:

public class TestUpInterceptor implements Interceptor {
    @Override public Response intercept(Chain chain) throws IOException {
        final Response response = chain.proceed(chain.request());
        //TODO: in case of exception retry in 3 sec
        return retryResponse;
    }
}

how to add a delay to interceptor?

Alex Klimashevsky
  • 2,457
  • 3
  • 26
  • 58
  • https://stackoverflow.com/questions/28536522/intercept-and-retry-call-by-means-of-okhttp-interceptors – denvercoder9 Jul 20 '18 at 09:26
  • Do you really want to repeat your request or you just worry that it might fail in case of patchy Internet ? [Coz you dont really need to worry about the latter](https://medium.com/inloopx/okhttp-is-quietly-retrying-requests-is-your-api-ready-19489ef35ace) – zeekhuge Jul 20 '18 at 09:56
  • @ZeekHuge I'd like to repeat – Alex Klimashevsky Jul 20 '18 at 10:26

0 Answers0