mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #25900 -- Fixed regression in CommonMiddleware ETag support.
This commit is contained in:
committed by
Tim Graham
parent
5bc881541c
commit
6be9589eb3
@@ -291,6 +291,16 @@ class CommonMiddlewareTest(SimpleTestCase):
|
||||
res = StreamingHttpResponse(['content'])
|
||||
self.assertFalse(CommonMiddleware().process_response(req, res).has_header('ETag'))
|
||||
|
||||
@override_settings(USE_ETAGS=True)
|
||||
def test_if_none_match(self):
|
||||
first_req = HttpRequest()
|
||||
first_res = CommonMiddleware().process_response(first_req, HttpResponse('content'))
|
||||
second_req = HttpRequest()
|
||||
second_req.method = 'GET'
|
||||
second_req.META['HTTP_IF_NONE_MATCH'] = first_res['ETag']
|
||||
second_res = CommonMiddleware().process_response(second_req, HttpResponse('content'))
|
||||
self.assertEqual(second_res.status_code, 304)
|
||||
|
||||
# Other tests
|
||||
|
||||
@override_settings(DISALLOWED_USER_AGENTS=[re.compile(r'foo')])
|
||||
|
||||
Reference in New Issue
Block a user