From 421e611356dd3abd8ea16bac128e602b892af73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 14 Mar 2018 17:22:47 +0100 Subject: [PATCH] Use objects instead of a list of parameters --- lib/cartodb/controllers/named_maps_admin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cartodb/controllers/named_maps_admin.js b/lib/cartodb/controllers/named_maps_admin.js index 79ab4451..ef49e652 100644 --- a/lib/cartodb/controllers/named_maps_admin.js +++ b/lib/cartodb/controllers/named_maps_admin.js @@ -26,7 +26,7 @@ NamedMapsAdminController.prototype.register = function (app) { userMiddleware(), localsMiddleware(), credentialsMiddleware(), - checkContentType('POST', 'POST TEMPLATE'), + checkContentType({ action: 'POST', label: 'POST TEMPLATE' }), authorizedByAPIKey(this.authApi, 'create', 'POST TEMPLATE'), createTemplate(this.templateMaps), sendResponse() @@ -38,7 +38,7 @@ NamedMapsAdminController.prototype.register = function (app) { userMiddleware(), localsMiddleware(), credentialsMiddleware(), - checkContentType('PUT', 'PUT TEMPLATE'), + checkContentType({ action: 'PUT', label: 'PUT TEMPLATE' }), authorizedByAPIKey(this.authApi, 'update', 'PUT TEMPLATE'), updateTemplate(this.templateMaps), sendResponse() @@ -83,7 +83,7 @@ NamedMapsAdminController.prototype.register = function (app) { ); }; -function checkContentType (action, label) { +function checkContentType ({ action, label }) { return function checkContentTypeMiddleware (req, res, next) { if (!req.is('application/json')) { const error = new Error(`template ${action} data must be of type application/json`);