Skip to content

Commit

Permalink
Issue #609 - Removes etag factory from helpers
Browse files Browse the repository at this point in the history
Fixes also a typo for cache-control.
  • Loading branch information
karlcow committed Feb 9, 2017
1 parent 773845a commit 47f18dc
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions webcompat/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,22 +458,11 @@ def api_request(method, path, params=None, data=None):
abort(404)


def make_etag(content):
'''Given a string creates an etag value.'''
etag = hashlib.md5(content).hexdigest()
return etag


def set_etag(response, etag):
'''Adds etag HTTP header to a response.'''
response.headers['Etag'] = etag
return response


def set_cache_control(response, seconds):
'''Adds Cache-Control headers with x seconds.
one day = 86400 seconds. The Cache is set as private.
'''
caching_header = 'private, max-age={time}'
response.headers['Cache-Control'] = caching_header.format(time=seconds)
return response

0 comments on commit 47f18dc

Please sign in to comment.