set expires header corresponding to maxAge (#1651)
* set expires header corresponding to maxAge * add tests
This commit is contained in:
@@ -105,6 +105,17 @@ describe('The request handler', function() {
|
||||
expect(handlerCallCount).to.equal(1);
|
||||
});
|
||||
|
||||
it('should set the expires header to current time', async function () {
|
||||
const res = await fetch(`${baseUri}/testing/123.json`);
|
||||
expect(res.headers.get('expires')).to.equal(res.headers.get('date'));
|
||||
});
|
||||
|
||||
it('should set the expires header to current time + max-age', async function () {
|
||||
const res = await fetch(`${baseUri}/testing/123.json?maxAge=3600`);
|
||||
const expectedExpiry = new Date(+(new Date(res.headers.get('date'))) + 3600000).toGMTString();
|
||||
expect(res.headers.get('expires')).to.equal(expectedExpiry);
|
||||
});
|
||||
|
||||
describe('the cache key', function () {
|
||||
const expectedCacheKey = '/testing/123.json?colorB=123&label=foo';
|
||||
it('should match expected and use canonical order - 1', async function () {
|
||||
|
||||
Reference in New Issue
Block a user