Skip to content

Commit

Permalink
fix: Use weak etags instead of etag (#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 Feb 16, 2020
1 parent 056c6ab commit 3c8991c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
language: python
python:
- '2.7'
- '3.4'
- '3.5'
- 'pypy'
- '3.7'
install:
- pip install -r requirements.txt
- pip install coveralls coverage
Expand Down
2 changes: 1 addition & 1 deletion flask_rest_jsonapi/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,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 3c8991c

Please sign in to comment.