diff options
Diffstat (limited to 'requests_cache/session.py')
-rw-r--r-- | requests_cache/session.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/requests_cache/session.py b/requests_cache/session.py index b65da1e..f3dec60 100644 --- a/requests_cache/session.py +++ b/requests_cache/session.py @@ -192,7 +192,16 @@ class CacheMixin(MIXIN_BASE): cached_response: Optional[CachedResponse] = None if not actions.skip_read: cached_response = self.cache.get_response(actions.cache_key) - actions.update_from_cached_response(cached_response) + actions.update_from_cached_response(cached_response, self.cache.create_key, **kwargs) + + # TODO: Does this fit better here, or in CacheActions? + # If response contains Vary, check that the specified request headers match + # if cached_response and cached_response.headers.get('Vary'): + # vary = cached_response.headers['Vary'] + # new_cache_key = self.cache.create_key(request, match_headers=vary) + # vary_cache_key = self.cache.create_key(cached_response.request, match_headers=vary) + # if new_cache_key != vary_cache_key: + # cached_response = None # Handle missing and expired responses based on settings and headers if actions.error_504: |