Add 'Carto-Stat-Tag', 'Carto-User-Id', and 'Carto-Client' headers
This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
module.exports = function incrementMapViewCount (metadataBackend) {
|
||||
return function incrementMapViewCountMiddleware (req, res, next) {
|
||||
const { mapConfig, user } = res.locals;
|
||||
const statTag = mapConfig.obj().stat_tag;
|
||||
|
||||
res.set('Carto-Stat-Tag', `${statTag}`);
|
||||
|
||||
// Error won't blow up, just be logged.
|
||||
metadataBackend.incMapviewCount(user, mapConfig.obj().stat_tag, (err) => {
|
||||
metadataBackend.incMapviewCount(user, statTag, (err) => {
|
||||
req.profiler.done('incMapviewCount');
|
||||
|
||||
if (err) {
|
||||
|
||||
@@ -14,6 +14,7 @@ module.exports = function user (metadataBackend) {
|
||||
}
|
||||
|
||||
res.locals.userId = userId;
|
||||
res.set('Carto-User-Id', `${userId}`);
|
||||
return next();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user