Let cached_endpoint pass the content-type header through.

This commit is contained in:
voussoir 2020-10-03 18:30:16 -07:00
parent 5d802ba9f9
commit e09c3300d1

View file

@ -43,6 +43,8 @@ def cached_endpoint(max_age):
if (not state['max_age']) or (time.time() - state['last_run'] > state['max_age']):
value = function(*args, **kwargs)
if isinstance(value, flask.Response):
if value.headers.get('Content-Type'):
state['headers']['Content-Type'] = value.headers.get('Content-Type')
value = value.response
if value != state['stored_value']:
state['stored_value'] = value