diff options
Diffstat (limited to 'django/middleware/cache.py')
| -rw-r--r-- | django/middleware/cache.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/middleware/cache.py b/django/middleware/cache.py index df26def6b4..10fff365af 100644 --- a/django/middleware/cache.py +++ b/django/middleware/cache.py @@ -29,8 +29,8 @@ More details about how the caching works: of the response's "Cache-Control" header, falling back to the CACHE_MIDDLEWARE_SECONDS setting if the section was not found. -* This middleware expects that a HEAD request is answered with the same response - headers exactly like the corresponding GET request. +* This middleware expects that a HEAD request is answered with the same + response headers exactly like the corresponding GET request. * When a hit occurs, a shallow copy of the original response object is returned from process_request. @@ -163,7 +163,8 @@ class FetchFromCacheMiddleware(MiddlewareMixin): request._cache_update_cache = True return None # No cache information available, need to rebuild. response = self.cache.get(cache_key) - # if it wasn't found and we are looking for a HEAD, try looking just for that + # if it wasn't found and we are looking for a HEAD, try looking just + # for that if response is None and request.method == "HEAD": cache_key = get_cache_key( request, self.key_prefix, "HEAD", cache=self.cache |
