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`);