From fe4ae3a90db2f4dc063f44a54c13ff5519c61ce3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sat, 15 Mar 2014 21:03:51 +0100 Subject: [PATCH] Add x-session-id header to cors middleware. And convert all simple quotes to double quotes. --- taiga/base/middleware.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/taiga/base/middleware.py b/taiga/base/middleware.py index 72fa1cc3..4f516c1e 100644 --- a/taiga/base/middleware.py +++ b/taiga/base/middleware.py @@ -5,11 +5,12 @@ import json from django import http -COORS_ALLOWED_ORIGINS = '*' -COORS_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE', 'PATCH', 'HEAD'] -COORS_ALLOWED_HEADERS = ['content-type', 'x-requested-with', - 'authorization', 'accept-encoding', - 'x-disable-pagination', 'x-host'] +COORS_ALLOWED_ORIGINS = "*" +COORS_ALLOWED_METHODS = ["POST", "GET", "OPTIONS", "PUT", "DELETE", "PATCH", "HEAD"] +COORS_ALLOWED_HEADERS = ["content-type", "x-requested-with", + "authorization", "accept-encoding", + "x-disable-pagination", "x-host", + "x-session-id"] COORS_ALLOWED_CREDENTIALS = True COORS_EXPOSE_HEADERS = ["x-pagination-count", "x-paginated", "x-paginated-by", "x-paginated-by", "x-pagination-current", "x-site-host", @@ -24,10 +25,10 @@ class CoorsMiddleware(object): response["Access-Control-Expose-Headers"] = ",".join(COORS_EXPOSE_HEADERS) if COORS_ALLOWED_CREDENTIALS: - response["Access-Control-Allow-Credentials"] = 'true' + response["Access-Control-Allow-Credentials"] = "true" def process_request(self, request): - if 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' in request.META: + if "HTTP_ACCESS_CONTROL_REQUEST_METHOD" in request.META: response = http.HttpResponse() self._populate_response(response) return response