Extract initProfiler middleware from map-controller

This commit is contained in:
Daniel García Aubert
2018-03-07 19:09:52 +01:00
parent 8509796743
commit 74b2f305ea
+3 -3
View File
@@ -72,7 +72,7 @@ MapController.prototype.composeCreateMapMiddleware = function (useTemplate = fal
userMiddleware(),
allowQueryParams(['aggregation']),
this.prepareContext,
this.initProfiler(isTemplateInstantiation),
initProfiler(isTemplateInstantiation),
this.checkJsonContentType(),
useTemplate ? this.checkInstantiteLayergroup() : this.checkCreateLayergroup(),
useTemplate ? this.getTemplate() : this.prepareAdapterMapConfig(),
@@ -97,7 +97,7 @@ MapController.prototype.composeCreateMapMiddleware = function (useTemplate = fal
];
};
MapController.prototype.initProfiler = function (isTemplateInstantiation) {
function initProfiler (isTemplateInstantiation) {
const operation = isTemplateInstantiation ? 'instance_template' : 'createmap';
return function initProfilerMiddleware (req, res, next) {
@@ -105,7 +105,7 @@ MapController.prototype.initProfiler = function (isTemplateInstantiation) {
req.profiler.done(`${operation}.initProfilerMiddleware`);
next();
};
};
}
MapController.prototype.checkJsonContentType = function () {
return function checkJsonContentTypeMiddleware(req, res, next) {