Skip to content

Commit

Permalink
Bug fix: response Cache-Control attribute does not get updated in the…
Browse files Browse the repository at this point in the history
… cache execution context in case of a cache miss
  • Loading branch information
ok2c committed Oct 14, 2024
1 parent aad0e9a commit e7b3a53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ public void cancelled() {
return asyncExecCallback.handleResponse(backendResponse, entityDetails);
}

final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
final ResponseCacheControl responseCacheControl = CacheControlHeaderParser.INSTANCE.parse(backendResponse);
context.setResponseCacheControl(responseCacheControl);
final boolean cacheable = responseCachingPolicy.isResponseCacheable(responseCacheControl, request, backendResponse);
if (cacheable) {
storeRequestIfModifiedSinceFor304Response(request, backendResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,9 @@ ClassicHttpResponse handleBackendResponse(
}
return backendResponse;
}
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
final ResponseCacheControl responseCacheControl = CacheControlHeaderParser.INSTANCE.parse(backendResponse);
context.setResponseCacheControl(responseCacheControl);
final boolean cacheable = responseCachingPolicy.isResponseCacheable(responseCacheControl, request, backendResponse);
if (cacheable) {
storeRequestIfModifiedSinceFor304Response(request, backendResponse);
Expand Down

0 comments on commit e7b3a53

Please sign in to comment.