Merge pull request #886 from CartoDB/vary-header

Vary header
This commit is contained in:
Eneko Lakasta
2018-03-12 12:46:42 +01:00
committed by GitHub
3 changed files with 4 additions and 0 deletions
@@ -6,6 +6,7 @@ module.exports = function credentials () {
res.locals.api_key = apikeyCredentials.token;
res.locals.basicAuthUsername = apikeyCredentials.username;
res.set('vary', 'Authorization'); //Honor Authorization header when caching.
return next();
};
+1
View File
@@ -155,6 +155,7 @@ describe('get requests with cache headers', function() {
assert.ok(res.headers['x-cache-channel']);
assert.ok(res.headers['surrogate-key']);
assert.equal(res.headers.vary, 'Authorization');
if (expectedCacheHeaders) {
validateXChannelHeaders(res.headers, expectedCacheHeaders);
assert.equal(res.headers['surrogate-key'], expectedCacheHeaders.surrogate_keys);
@@ -61,6 +61,8 @@ describe('prepare-context', function() {
}
res.locals.user = 'localhost';
res.set = function () {};
return res;
}