Extract sendResponse middleware from context

This commit is contained in:
Daniel García Aubert 2018-03-14 13:32:43 +01:00
parent a5c508733a
commit 091efe52fc

View File

@ -60,7 +60,7 @@ NamedMapsController.prototype.register = function(app) {
setLastModifiedHeader(),
setCacheControlHeader(),
setContentTypeHeader(),
this.respond(),
sendResponse(),
vectorError()
);
@ -89,7 +89,7 @@ NamedMapsController.prototype.register = function(app) {
setLastModifiedHeader(),
setCacheControlHeader(),
setContentTypeHeader(),
this.respond()
sendResponse()
);
};
@ -490,8 +490,8 @@ function setContentTypeHeader () {
};
}
NamedMapsController.prototype.respond = function () {
return function respondMiddleware (req, res) {
function sendResponse () {
return function sendResponseMiddleware (req, res) {
const { body, stats = {}, format } = res.locals;
req.profiler.done('render-' + format);
@ -500,4 +500,4 @@ NamedMapsController.prototype.respond = function () {
res.status(200);
res.send(body);
};
};
}