diff --git a/lib/cartodb/controllers/map.js b/lib/cartodb/controllers/map.js index 9c2168d5..6650fd20 100644 --- a/lib/cartodb/controllers/map.js +++ b/lib/cartodb/controllers/map.js @@ -73,7 +73,7 @@ MapController.prototype.composeCreateMapMiddleware = function (useTemplate = fal allowQueryParams(['aggregation']), this.prepareContext, initProfiler(isTemplateInstantiation), - this.checkJsonContentType(), + checkJsonContentType(), useTemplate ? this.checkInstantiteLayergroup() : this.checkCreateLayergroup(), useTemplate ? this.getTemplate() : this.prepareAdapterMapConfig(), useTemplate ? this.instantiateLayergroup() : this.createLayergroup(), @@ -107,7 +107,7 @@ function initProfiler (isTemplateInstantiation) { }; } -MapController.prototype.checkJsonContentType = function () { +function checkJsonContentType () { return function checkJsonContentTypeMiddleware(req, res, next) { if (req.method === 'POST' && !req.is('application/json')) { return next(new Error('POST data must be of type application/json')); @@ -117,7 +117,7 @@ MapController.prototype.checkJsonContentType = function () { next(); }; -}; +} MapController.prototype.checkInstantiteLayergroup = function () { return function checkInstantiteLayergroupMiddleware(req, res, next) {