also send cache-control
This commit is contained in:
parent
f6902ca73c
commit
855a5b426b
|
@ -45,9 +45,10 @@ export default async (req: Request, res: Response, next) => {
|
|||
let curEtag = chunkEtags.get(etagKey);
|
||||
const preEtag = req.headers['if-none-match'];
|
||||
|
||||
if (curEtag && preEtag === curEtag) {
|
||||
if (curEtag && preEtag && preEtag === curEtag) {
|
||||
res.set({
|
||||
ETag: curEtag,
|
||||
'Cache-Control': `public, s-maxage=${60}, max-age=${40}`, // seconds
|
||||
});
|
||||
res.status(304).end();
|
||||
return;
|
||||
|
@ -69,10 +70,12 @@ export default async (req: Request, res: Response, next) => {
|
|||
|
||||
res.set({
|
||||
'Cache-Control': `public, s-maxage=${60}, max-age=${40}`, // seconds
|
||||
'Content-Type': 'application/octet-stream',
|
||||
});
|
||||
|
||||
if (!chunk) {
|
||||
res.set({
|
||||
'Content-Type': 'application/octet-stream',
|
||||
});
|
||||
res.status(200).end();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user