def enable_cors(response):
"""
Enable Cross-origin resource sharing.
These headers are needed for the clients that
will consume the API via AJAX requests.
"""
if request.method == OPTIONS_METHOD:
response = current_app.make_default_options_response()
response.headers[ACL_ORIGIN] = ALLOWED_ORIGINS
response.headers[ACL_METHODS] = ALLOWED_METHODS
response.headers[ACL_ALLOWED_HEADERS] = ALLOWED_HEADERS
return response
评论列表
文章目录