Added CORS headers to API json_response
This commit is contained in:
parent
3a1993288f
commit
965b39a84f
@ -63,6 +63,11 @@ def json_response(serializable, *args, **kw):
|
|||||||
'''
|
'''
|
||||||
response = Response(json.dumps(serializable), *args, **kw)
|
response = Response(json.dumps(serializable), *args, **kw)
|
||||||
response.headers['Content-Type'] = 'application/json'
|
response.headers['Content-Type'] = 'application/json'
|
||||||
|
cors_headers = {
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||||
|
'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With'}
|
||||||
|
response.headers.update(cors_headers)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user