MCPcopy
hub / github.com/django/django / test_no_head

Method test_no_head

tests/middleware/tests.py:762–774  ·  view source on GitHub ↗

ConditionalGetMiddleware shouldn't compute and return an ETag on a HEAD request since it can't do so accurately without access to the response body of the corresponding GET.

(self)

Source from the content-addressed store, hash-verified

760 ) # should never be a 412
761
762 def test_no_head(self):
763 """
764 ConditionalGetMiddleware shouldn't compute and return an ETag on a
765 HEAD request since it can't do so accurately without access to the
766 response body of the corresponding GET.
767 """
768
769 def get_200_response(req):
770 return HttpResponse(status=200)
771
772 request = self.request_factory.head("/")
773 conditional_get_response = ConditionalGetMiddleware(get_200_response)(request)
774 self.assertNotIn("ETag", conditional_get_response)
775
776
777class XFrameOptionsMiddlewareTest(SimpleTestCase):

Callers

nothing calls this directly

Calls 2

headMethod · 0.45

Tested by

no test coverage detected