Do not get headers from abaculus

This commit is contained in:
Daniel García Aubert 2019-06-10 13:16:05 +02:00
parent dc16f4cebf
commit 20fe04de38

View File

@ -263,7 +263,7 @@ function getImage({ previewBackend, label }) {
if (zoom !== undefined && center) {
return previewBackend.getImage(mapConfigProvider, format, width, height, zoom, center,
(err, image, headers, stats) => {
(err, image, stats) => {
req.profiler.add(stats);
if (err) {
@ -271,10 +271,6 @@ function getImage({ previewBackend, label }) {
return next(err);
}
if (headers) {
res.set(headers);
}
res.statusCode = 200;
res.body = image;
@ -282,7 +278,7 @@ function getImage({ previewBackend, label }) {
});
}
previewBackend.getImage(mapConfigProvider, format, width, height, bounds, (err, image, headers, stats) => {
previewBackend.getImage(mapConfigProvider, format, width, height, bounds, (err, image, stats) => {
req.profiler.add(stats);
req.profiler.done('render-' + format);
@ -291,10 +287,6 @@ function getImage({ previewBackend, label }) {
return next(err);
}
if (headers) {
res.set(headers);
}
res.statusCode = 200;
res.body = image;
@ -305,7 +297,9 @@ function getImage({ previewBackend, label }) {
function setContentTypeHeader () {
return function setContentTypeHeaderMiddleware(req, res, next) {
res.set('Content-Type', res.get('content-type') || res.get('Content-Type') || 'image/png');
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
res.set('Content-Type', `image/${format}`);
next();
};