Caching with Retrofit 2.0 and okhttp3
I'm trying to implement caching using Retrofit and OkHttp. Here what I've already done: private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { @Override public Response intercept(Interceptor.Chain chain) throws IOException { Request originalRequest = chain.request(); Request.Builder request = originalRequest.newBuilder(); Response response = chain.proceed(request.build()); return response.newBuilder() .removeHeader("Pragma") .removeHeader("Cache-Control") .header("Cache-Control", "max-age=2419200") .build(); } }; @Provides @Singleton OkHttpClient