def csp_header(csp={}):
_csp = csp_default().read()<EOL>_csp.update(csp)<EOL>_header = '<STR_LIT>'<EOL>if '<STR_LIT>' in _csp and _csp['<STR_LIT>'] is True:<EOL><INDENT>_header = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>_header = '<STR_LIT>'<EOL><DEDENT>if '<STR_LIT>' in _csp:<EOL><INDENT>del _csp['<STR_LIT>']<EOL><DEDENT>_headers = {_header: create_csp_header(_csp)}<EOL>def decorator(f):<EOL><INDENT>@wraps(f)<EOL>def decorated_function(*args, **kwargs):<EOL><INDENT>resp = make_response(f(*args, **kwargs))<EOL>h = resp.headers<EOL>for header, value in _headers.items():<EOL><INDENT>h[header] = value<EOL><DEDENT>return resp<EOL><DEDENT>return decorated_function<EOL><DEDENT>return decorator<EOL>
Decorator to include csp header on app.route wrapper