ETag must be between double quotes per spec
This commit is contained in:
parent
cfcb83dbfb
commit
0300a5f962
1 changed files with 2 additions and 2 deletions
|
@ -719,7 +719,7 @@ class GZipMixin(object):
|
||||||
def etag(self):
|
def etag(self):
|
||||||
path = self.path()
|
path = self.path()
|
||||||
with open(path, mode='rb') as f:
|
with open(path, mode='rb') as f:
|
||||||
return hashlib.md5(f.read()).hexdigest()
|
return '"%s"' % hashlib.md5(f.read()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
class DataLayerView(GZipMixin, BaseDetailView):
|
class DataLayerView(GZipMixin, BaseDetailView):
|
||||||
|
@ -742,7 +742,7 @@ class DataLayerView(GZipMixin, BaseDetailView):
|
||||||
content_type='application/json'
|
content_type='application/json'
|
||||||
)
|
)
|
||||||
response["Last-Modified"] = http_date(statobj.st_mtime)
|
response["Last-Modified"] = http_date(statobj.st_mtime)
|
||||||
response['ETag'] = '%s' % hashlib.md5(force_bytes(response.content)).hexdigest() # noqa
|
response['ETag'] = '"%s"' % hashlib.md5(force_bytes(response.content)).hexdigest() # noqa
|
||||||
response['Content-Length'] = len(response.content)
|
response['Content-Length'] = len(response.content)
|
||||||
if path.endswith(self.EXT):
|
if path.endswith(self.EXT):
|
||||||
response['Content-Encoding'] = 'gzip'
|
response['Content-Encoding'] = 'gzip'
|
||||||
|
|
Loading…
Reference in a new issue