Use objects instead of a list of parameters
This commit is contained in:
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user