fix cache header with 0 age

This commit is contained in:
TheBeastLT
2022-10-22 16:49:25 +02:00
parent d666716140
commit 340fbfff4b

View File

@@ -46,7 +46,7 @@ router.get('/:configuration/:resource/:type/:id/:extra?.json', (req, res, next)
staleError: 'stale-if-error'
};
const cacheControl = Object.keys(cacheHeaders)
.map(prop => resp[prop] && cacheHeaders[prop] + '=' + resp[prop])
.map(prop => Number.isInteger(resp[prop]) && cacheHeaders[prop] + '=' + resp[prop])
.filter(val => !!val).join(', ');
res.setHeader('Cache-Control', `${cacheControl}, public`);