Loading django/views/decorators/http.py +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ def condition(etag_func=None, last_modified_func=None): } ) response = HttpResponse(status=412) elif (not if_none_match and request.method == "GET" and elif (not if_none_match and request.method in ("GET", "HEAD") and res_last_modified and if_modified_since and res_last_modified <= if_modified_since): response = HttpResponseNotModified() Loading tests/conditional_processing/tests.py +5 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,11 @@ class ConditionalGet(TestCase): response = self.client.get('/condition/last_modified2/') self.assertFullResponse(response, check_etag=False) def test_single_condition_head(self): self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR response = self.client.head('/condition/') self.assertNotModified(response) def test_invalid_etag(self): self.client.defaults['HTTP_IF_NONE_MATCH'] = r'"\"' response = self.client.get('/condition/etag/') Loading Loading
django/views/decorators/http.py +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ def condition(etag_func=None, last_modified_func=None): } ) response = HttpResponse(status=412) elif (not if_none_match and request.method == "GET" and elif (not if_none_match and request.method in ("GET", "HEAD") and res_last_modified and if_modified_since and res_last_modified <= if_modified_since): response = HttpResponseNotModified() Loading
tests/conditional_processing/tests.py +5 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,11 @@ class ConditionalGet(TestCase): response = self.client.get('/condition/last_modified2/') self.assertFullResponse(response, check_etag=False) def test_single_condition_head(self): self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR response = self.client.head('/condition/') self.assertNotModified(response) def test_invalid_etag(self): self.client.defaults['HTTP_IF_NONE_MATCH'] = r'"\"' response = self.client.get('/condition/etag/') Loading