From 8867cdbc02ed47afd8ae5f6f7c482e603872fb07 Mon Sep 17 00:00:00 2001 From: Eneko Lakasta Date: Mon, 26 Feb 2018 15:57:42 +0100 Subject: [PATCH] use anonymous function instead of arrow function in middleware export to don't bind this --- lib/cartodb/middleware/context/apikey-credentials.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/cartodb/middleware/context/apikey-credentials.js b/lib/cartodb/middleware/context/apikey-credentials.js index bde45da4..5302050e 100644 --- a/lib/cartodb/middleware/context/apikey-credentials.js +++ b/lib/cartodb/middleware/context/apikey-credentials.js @@ -1,10 +1,12 @@ 'use strict'; -module.exports = () => function apikeyTokenMiddleware(req, res, next) { - const apikeyCredentials = getApikeyCredentialsFromRequest(req); - res.locals.api_key = apikeyCredentials.token; - res.locals.apikeyUsername = apikeyCredentials.username; - return next(); +module.exports = function() { + return function apikeyTokenMiddleware(req, res, next) { + const apikeyCredentials = getApikeyCredentialsFromRequest(req); + res.locals.api_key = apikeyCredentials.token; + res.locals.apikeyUsername = apikeyCredentials.username; + return next(); + }; }; //--------------------------------------------------------------------------------