Extract checkJsonContentType middleware from MapController class
This commit is contained in:
parent
74b2f305ea
commit
d26910ba9c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user