projects
/
mediagoblin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a19932
)
Added CORS headers to API json_response
author
Joar Wandborg
<git@wandborg.com>
Sat, 15 Sep 2012 20:18:49 +0000
(22:18 +0200)
committer
Joar Wandborg
<git@wandborg.com>
Sat, 15 Sep 2012 20:18:49 +0000
(22:18 +0200)
mediagoblin/plugins/api/tools.py
patch
|
blob
|
blame
|
history
diff --git
a/mediagoblin/plugins/api/tools.py
b/mediagoblin/plugins/api/tools.py
index e3b15b2332bec88b825849d040c181699b61a9e8..5488e5159b002158ea18a2f4fd870cf461e88c90 100644
(file)
--- a/
mediagoblin/plugins/api/tools.py
+++ b/
mediagoblin/plugins/api/tools.py
@@
-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