From 541efa6437c1f43eeea146f0acb44b0e04bda50e Mon Sep 17 00:00:00 2001 From: spl0k Date: Sat, 15 Aug 2015 16:07:28 +0200 Subject: [PATCH] Added header allowing web-clients using JSON to work --- supysonic/api/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/supysonic/api/__init__.py b/supysonic/api/__init__.py index 15b1084..41b1418 100644 --- a/supysonic/api/__init__.py +++ b/supysonic/api/__init__.py @@ -76,13 +76,15 @@ def authorize(): request.user = user @app.after_request -def set_content_type(response): +def set_headers(response): if not request.path.startswith('/rest/'): return response if response.mimetype.startswith('text'): f = request.args.get('f') - response.headers['content-type'] = 'application/json' if f in [ 'jsonp', 'json' ] else 'text/xml' + response.headers['Content-Type'] = 'application/json' if f in [ 'jsonp', 'json' ] else 'text/xml' + + response.headers['Access-Control-Allow-Origin'] = '*' return response