summaryrefslogtreecommitdiff
path: root/tests/middleware/tests.py
diff options
context:
space:
mode:
authorDerek J. Curtis <djcurtis@summersetsoftware.com>2015-12-09 18:07:02 +0700
committerTim Graham <timograham@gmail.com>2015-12-10 13:51:07 -0500
commit6be9589eb34f79914666c9d9e1e15bdb7fc44df2 (patch)
tree8c9a8a173e92ab1c47737df2bb73c094025774d9 /tests/middleware/tests.py
parent5bc881541caafbac6911fb26d9718b8ad6d45b2a (diff)
downloaddjango-6be9589eb34f79914666c9d9e1e15bdb7fc44df2.tar.gz
Fixed #25900 -- Fixed regression in CommonMiddleware ETag support.
Diffstat (limited to 'tests/middleware/tests.py')
-rw-r--r--tests/middleware/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py
index 7ccfd919cc..3e18ee7645 100644
--- a/tests/middleware/tests.py
+++ b/tests/middleware/tests.py
@@ -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')])