Add Vary: Accept-Encoding header
This commit is contained in:
parent
0300a5f962
commit
a8dee3fa07
2 changed files with 2 additions and 0 deletions
|
@ -28,6 +28,7 @@ def test_get(client, settings, datalayer):
|
|||
assert response['ETag'] is not None
|
||||
assert response['Last-Modified'] is not None
|
||||
assert response['Cache-Control'] is not None
|
||||
assert response['Vary'] == 'Accept-Encoding'
|
||||
assert 'Content-Encoding' not in response
|
||||
j = json.loads(response.content.decode())
|
||||
assert '_umap_options' in j
|
||||
|
|
|
@ -744,6 +744,7 @@ class DataLayerView(GZipMixin, BaseDetailView):
|
|||
response["Last-Modified"] = http_date(statobj.st_mtime)
|
||||
response['ETag'] = '"%s"' % hashlib.md5(force_bytes(response.content)).hexdigest() # noqa
|
||||
response['Content-Length'] = len(response.content)
|
||||
response['Vary'] = 'Accept-Encoding'
|
||||
if path.endswith(self.EXT):
|
||||
response['Content-Encoding'] = 'gzip'
|
||||
return response
|
||||
|
|
Loading…
Reference in a new issue