plugins/api: use headers.set(), not headers.update()

The werkzeug.Response().headers do not offer an update() method as
the same key can be twice in the header 'dict'. Thus, iterate over
the header keys and use header.set(key, value) which replaces an
existing header key.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-12-12 11:38:51 +01:00
parent 74af60bb32
commit 7c552c0bd7

View File

@ -71,7 +71,7 @@ def json_response(serializable, _disable_cors=False, *args, **kw):
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With'} 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With'}
response.headers.update(cors_headers) (response.headers.set(key, value) for key, value in cors_headers)
return response return response