Merge pull request #1168 from CartoDB/dgaubert/ch77050/data-in-headers

Avoid custom headers to be undefined
This commit is contained in:
Daniel G. Aubert 2020-05-29 16:16:19 +02:00 committed by GitHub
commit 17337974a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,7 @@ Announcements:
- Remove `bootstrapFonts` at process startup (now done in `windshaft@6.0.0`) - Remove `bootstrapFonts` at process startup (now done in `windshaft@6.0.0`)
- Stop checking the installed version of some dependencies while testing - Stop checking the installed version of some dependencies while testing
- Send metrics about `map views` (#1162) - Send metrics about `map views` (#1162)
- Add custom headers in responses to allow to other components to be able to get insights about user activity.
Bug Fixes: Bug Fixes:
- Parsing date column in numeric histograms (#1160) - Parsing date column in numeric histograms (#1160)

View File

@ -353,7 +353,9 @@ function incrementMapViews ({ metadataBackend }) {
const statTag = mapConfig.obj().stat_tag; const statTag = mapConfig.obj().stat_tag;
res.set('Carto-Stat-Tag', `${statTag}`); if (statTag) {
res.set('Carto-Stat-Tag', `${statTag}`);
}
metadataBackend.incMapviewCount(user, statTag, (err) => { metadataBackend.incMapviewCount(user, statTag, (err) => {
if (err) { if (err) {

View File

@ -5,7 +5,9 @@ module.exports = function incrementMapViewCount (metadataBackend) {
const { mapConfig, user } = res.locals; const { mapConfig, user } = res.locals;
const statTag = mapConfig.obj().stat_tag; const statTag = mapConfig.obj().stat_tag;
res.set('Carto-Stat-Tag', `${statTag}`); if (statTag) {
res.set('Carto-Stat-Tag', `${statTag}`);
}
// Error won't blow up, just be logged. // Error won't blow up, just be logged.
metadataBackend.incMapviewCount(user, statTag, (err) => { metadataBackend.incMapviewCount(user, statTag, (err) => {