Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello yale88. I'm curious about the HttpCacheInterceptor. #190

Open
jtm0609 opened this issue Apr 7, 2021 · 0 comments
Open

Hello yale88. I'm curious about the HttpCacheInterceptor. #190

jtm0609 opened this issue Apr 7, 2021 · 0 comments

Comments

@jtm0609
Copy link

jtm0609 commented Apr 7, 2021

Mobile: Samsung

Android OS: 10

NetWork: < WiFi

URL:

LIB Version: 2.1.8

Hi yale88, I'm analyzing your library. And then I got a question.
I attached the code below.

removeHeader("pragma").removeHeader("Cache-Control")

Can you tell me why you used this code?

class HttpCacheInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        String cache = request.header(WebViewCacheInterceptor.KEY_CACHE);
        Response originResponse = chain.proceed(request);
        if (!TextUtils.isEmpty(cache)&&cache.equals(CacheType.NORMAL.ordinal()+"")){
            return originResponse;
        }
        return originResponse.newBuilder().removeHeader("pragma").removeHeader("Cache-Control")
                .header("Cache-Control","max-age=3153600000").build();
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant