diff --git a/umap/tests/test_datalayer_views.py b/umap/tests/test_datalayer_views.py index d88bdd69..01fd5c64 100644 --- a/umap/tests/test_datalayer_views.py +++ b/umap/tests/test_datalayer_views.py @@ -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 diff --git a/umap/views.py b/umap/views.py index 55f307fe..8ab823d2 100644 --- a/umap/views.py +++ b/umap/views.py @@ -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