mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 08:56:17 +00:00
Added header allowing web-clients using JSON to work
This commit is contained in:
parent
5fdd28290b
commit
541efa6437
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user