fix: cache error
This commit is contained in:
parent
454850c6b3
commit
22fad337ae
@ -25,16 +25,18 @@ export const handler: Handlers = {
|
|||||||
const mtime = stat.mtime ?? new Date(0);
|
const mtime = stat.mtime ?? new Date(0);
|
||||||
const body = await Deno.readTextFile(path);
|
const body = await Deno.readTextFile(path);
|
||||||
headers.set("last-modified", mtime.toUTCString());
|
headers.set("last-modified", mtime.toUTCString());
|
||||||
|
console.log(mtime);
|
||||||
|
// headers.set("cache-control", "max-age=600");
|
||||||
|
|
||||||
const ifModifiedSinceValue = req.headers.get("if-modified-since");
|
// const ifModifiedSinceValue = req.headers.get("if-modified-since");
|
||||||
if ( ifModifiedSinceValue &&
|
// if ( ifModifiedSinceValue &&
|
||||||
mtime.getTime() != new Date(ifModifiedSinceValue).getTime()
|
// mtime.getTime() <= new Date(ifModifiedSinceValue).getTime()
|
||||||
){
|
// ){
|
||||||
return new Response(null, {
|
// return new Response(null, {
|
||||||
status: Status.NotModified,
|
// status: Status.NotModified,
|
||||||
statusText: STATUS_TEXT[Status.NotModified]
|
// statusText: STATUS_TEXT[Status.NotModified]
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
return new Response(body, {headers});
|
return new Response(body, {headers});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user