Fixed #26765 -- Made CommonMiddleware no longer set an ETag when response has Cache-Control: no-store.

This commit is contained in:
andrewnester 2016-06-20 22:46:33 +03:00 committed by Tim Graham
parent ba246bd5fe
commit 20d39325ca
2 changed files with 25 additions and 2 deletions

View file

@ -275,6 +275,20 @@ class CommonMiddlewareTest(SimpleTestCase):
res = StreamingHttpResponse(['content'])
self.assertFalse(CommonMiddleware().process_response(req, res).has_header('ETag'))
@override_settings(USE_ETAGS=True)
def test_no_etag_no_store_cache(self):
req = HttpRequest()
res = HttpResponse('content')
res['Cache-Control'] = 'No-Cache, No-Store, Max-age=0'
self.assertFalse(CommonMiddleware().process_response(req, res).has_header('ETag'))
@override_settings(USE_ETAGS=True)
def test_etag_extended_cache_control(self):
req = HttpRequest()
res = HttpResponse('content')
res['Cache-Control'] = 'my-directive="my-no-store"'
self.assertTrue(CommonMiddleware().process_response(req, res).has_header('ETag'))
@override_settings(USE_ETAGS=True)
def test_if_none_match(self):
first_req = HttpRequest()