Always serve multilayer tiles and grids with persisting cache request
This commit is contained in:
parent
60242c80f4
commit
65c7c5fc9c
@ -210,6 +210,7 @@ module.exports = function(){
|
|||||||
if ( req.method != 'GET' || ! req.res ) { cb(null, null); return; }
|
if ( req.method != 'GET' || ! req.res ) { cb(null, null); return; }
|
||||||
var res = req.res;
|
var res = req.res;
|
||||||
var cache_policy = req.query.cache_policy;
|
var cache_policy = req.query.cache_policy;
|
||||||
|
if ( req.params.token ) cache_policy = 'persist';
|
||||||
if ( cache_policy == 'persist' ) {
|
if ( cache_policy == 'persist' ) {
|
||||||
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
|
res.header('Cache-Control', 'public,max-age=31536000'); // 1 year
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,8 +92,12 @@ suite('multilayer', function() {
|
|||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.equal(res.statusCode, 200, res.body);
|
||||||
assert.equal(res.headers['content-type'], "image/png");
|
assert.equal(res.headers['content-type'], "image/png");
|
||||||
|
|
||||||
|
// Check Cache-Control
|
||||||
|
var cc = res.headers['cache-control'];
|
||||||
|
assert.equal(cc, 'public,max-age=31536000'); // 1 year
|
||||||
|
|
||||||
// Check X-Cache-Channel
|
// Check X-Cache-Channel
|
||||||
var cc = res.headers['x-cache-channel'];
|
cc = res.headers['x-cache-channel'];
|
||||||
assert.ok(cc);
|
assert.ok(cc);
|
||||||
var dbname = 'cartodb_test_user_1_db'
|
var dbname = 'cartodb_test_user_1_db'
|
||||||
assert.equal(cc.substring(0, dbname.length), dbname);
|
assert.equal(cc.substring(0, dbname.length), dbname);
|
||||||
|
Loading…
Reference in New Issue
Block a user