Skip to content

Commit

Permalink
fix: Use weak etags instead of etag (fossasia#9)
Browse files Browse the repository at this point in the history
We are not conforming to strong etags anyway and they are dropped
by cloudlare and nginx when response is compressed as it is not
hash of final output response
  • Loading branch information
iamareebjamal authored and pguyot committed May 12, 2021
1 parent 9fca6ce commit a942652
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flask_rest_jsonapi/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def dispatch_request(self, *args, **kwargs):

# ETag Handling
if current_app.config.get('ETAG') == True:
etag = hashlib.sha1(resp.get_data()).hexdigest()
etag = f'W/"{hashlib.sha1(resp.get_data()).hexdigest()}"'
resp.headers['ETag'] = etag

if_match = request.headers.get('If-Match')
Expand Down

0 comments on commit a942652

Please sign in to comment.