set mapType in the controller instead of in the adapter

This commit is contained in:
Eneko Lakasta 2018-09-04 16:20:38 +02:00
parent 006e21379f
commit b75150e91e
3 changed files with 10 additions and 3 deletions

View File

@ -158,7 +158,10 @@ function prepareAdapterMapConfig (mapConfigAdapter) {
context,
(err, requestMapConfig, stats = { overviewsUsed : false }) => {
req.profiler.done('anonymous.getMapConfig');
stats.mapType = 'anonymous';
req.profiler.add(stats);
if (err) {
return next(err);

View File

@ -37,8 +37,7 @@ MapConfigOverviewsAdapter.prototype.getMapConfig = function (user, requestMapCon
requestMapConfig.layers = layers;
const stats = { overviewsAddedToMapconfig,
mapType: 'anonymous' };
const stats = { overviewsAddedToMapconfig };
return callback(null, requestMapConfig, stats);
});

View File

@ -72,7 +72,12 @@ describe('overviews metadata', function() {
data: JSON.stringify(layergroup)
}, {}, function(res) {
assert.equal(res.statusCode, 200, res.body);
assert.ok(JSON.parse(res.headers['x-tiler-profiler']).overviewsAddedToMapconfig);
const headers = JSON.parse(res.headers['x-tiler-profiler']);
assert.ok(headers.overviewsAddedToMapconfig);
assert.equal(headers.mapType, 'anonymous');
var parsedBody = JSON.parse(res.body);
assert.equal(res.headers['x-layergroup-id'], parsedBody.layergroupid);
expected_token = parsedBody.layergroupid;