Please JSHint
This commit is contained in:
parent
5a7ffcf499
commit
ebff2ac9f2
@ -27,7 +27,12 @@ module.exports = function setCacheControlHeader ({
|
|||||||
revalidate = false
|
revalidate = false
|
||||||
} = {}) {
|
} = {}) {
|
||||||
if (!validFallbackTTL.includes(fallbackTtl)) {
|
if (!validFallbackTTL.includes(fallbackTtl)) {
|
||||||
throw new Error(`Invalid fallback TTL value for Cache-Control header. Got ${fallbackTtl}, expected ${validFallbackTTL.join(', ')}`);
|
const message = [
|
||||||
|
'Invalid fallback TTL value for Cache-Control header.',
|
||||||
|
`Got ${fallbackTtl}, expected ${validFallbackTTL.join(', ')}`
|
||||||
|
].join(' ');
|
||||||
|
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function setCacheControlHeaderMiddleware (req, res, next) {
|
return function setCacheControlHeaderMiddleware (req, res, next) {
|
||||||
|
@ -80,8 +80,8 @@ describe('cache-control header', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cacheControl = res.headers['cache-control'];
|
const cacheControl = res.headers['cache-control'];
|
||||||
const [ type, maxAge ] = cacheControl.split(',');
|
const [ , maxAge ] = cacheControl.split(',');
|
||||||
const [ key, value ] = maxAge.split('=');
|
const [ , value ] = maxAge.split('=');
|
||||||
|
|
||||||
assert.ok(Number(value) <= ttl);
|
assert.ok(Number(value) <= ttl);
|
||||||
|
|
||||||
@ -120,8 +120,8 @@ describe('cache-control header', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cacheControl = res.headers['cache-control'];
|
const cacheControl = res.headers['cache-control'];
|
||||||
const [ type, maxAge ] = cacheControl.split(',');
|
const [ , maxAge ] = cacheControl.split(',');
|
||||||
const [ key, value ] = maxAge.split('=');
|
const [ , value ] = maxAge.split('=');
|
||||||
|
|
||||||
assert.ok(Number(value) <= ttl);
|
assert.ok(Number(value) <= ttl);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user