mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #30812 -- Made ConditionalGetMiddleware set ETag only for responses with non-empty content.
This commit is contained in:
committed by
Mariusz Felisiak
parent
3cd3bebe89
commit
ee6b17187f
@@ -452,6 +452,12 @@ class ConditionalGetMiddlewareTest(SimpleTestCase):
|
||||
res = StreamingHttpResponse(['content'])
|
||||
self.assertFalse(ConditionalGetMiddleware().process_response(self.req, res).has_header('ETag'))
|
||||
|
||||
def test_no_etag_response_empty_content(self):
|
||||
res = HttpResponse()
|
||||
self.assertFalse(
|
||||
ConditionalGetMiddleware().process_response(self.req, res).has_header('ETag')
|
||||
)
|
||||
|
||||
def test_no_etag_no_store_cache(self):
|
||||
self.resp['Cache-Control'] = 'No-Cache, No-Store, Max-age=0'
|
||||
self.assertFalse(ConditionalGetMiddleware().process_response(self.req, self.resp).has_header('ETag'))
|
||||
|
||||
Reference in New Issue
Block a user