epicpost/funding/bin/utils_request.py

29 lines
649 B
Python
Raw Normal View History

2022-08-07 12:15:02 +00:00
from flask import request
import settings
from funding.factory import app, db
@app.before_request
def before_request():
pass
@app.after_request
def after_request(res):
res.headers.add('Accept-Ranges', 'bytes')
if request.full_path.startswith('/api/'):
res.headers.add('Access-Control-Allow-Origin', '*')
if settings.DEBUG:
res.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
res.headers['Pragma'] = 'no-cache'
res.headers['Expires'] = '0'
res.headers['Cache-Control'] = 'public, max-age=0'
return res
@app.errorhandler(404)
def error(err):
return 'Error', 404