From 314508bcd8d88ad0401e817722092a39379cbc8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 1 Mar 2018 18:46:04 +0100 Subject: [PATCH] Middleware naming convention --- lib/cartodb/middleware/cors.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/cartodb/middleware/cors.js b/lib/cartodb/middleware/cors.js index 227bb477..ee924a90 100644 --- a/lib/cartodb/middleware/cors.js +++ b/lib/cartodb/middleware/cors.js @@ -1,11 +1,14 @@ module.exports = function cors(extraHeaders) { - return function(req, res, next) { + return function corsMiddleware (req, res, next) { var baseHeaders = "X-Requested-With, X-Prototype-Version, X-CSRF-Token"; + if(extraHeaders) { baseHeaders += ", " + extraHeaders; } + res.set("Access-Control-Allow-Origin", "*"); res.set("Access-Control-Allow-Headers", baseHeaders); + next(); }; };