api should not break if it sends a 304

This commit is contained in:
Laura Klünder 2017-10-28 19:04:34 +02:00
parent 4771f8828e
commit b5337af65e

View file

@ -6,7 +6,8 @@ class RemoveEtagFromHTMLApiViewMiddleware:
response = self.get_response(request)
if request.path.startswith('/api/'):
if response['content-type'].startswith('text/html') and response.has_header('etag'):
del response['etag']
if response.has_header('content-type') and response['content-type'].startswith('text/html'):
if response.has_header('etag'):
del response['etag']
return response