1

OkHttp3 uses this method in it's cache class to match request and cached responses, my problem is sometimes I don't like to match headers, just URL is fair enough. How can I bypass header matching (comparison) in Cache class? For example maybe I like to accept cached items from previous authentication, while currently token is expired, so I don't like to match tokens.

public boolean matches(Request request, Response response) {
      return url.equals(request.url().toString())
          && requestMethod.equals(request.method())
          && HttpHeaders.varyMatches(response, varyHeaders, request);
    }
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
  • As per my understanding, already answered here. https://stackoverflow.com/questions/29053156/how-to-tell-okhttpclient-to-ignore-cache-and-force-refresh-from-server – BigHeadNelson Mar 04 '21 at 04:31

0 Answers0