Added CORS headers to API json_response

This commit is contained in:
Joar Wandborg 2012-09-15 22:18:49 +02:00
parent 3a1993288f
commit 965b39a84f

View File

@ -63,6 +63,11 @@ def json_response(serializable, *args, **kw):
'''
response = Response(json.dumps(serializable), *args, **kw)
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