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)
| 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 | |
| 777 | class XFrameOptionsMiddlewareTest(SimpleTestCase): |
nothing calls this directly
no test coverage detected