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 body = await Deno.readTextFile(path);
|
||||
headers.set("last-modified", mtime.toUTCString());
|
||||
console.log(mtime);
|
||||
// headers.set("cache-control", "max-age=600");
|
||||
|
||||
const ifModifiedSinceValue = req.headers.get("if-modified-since");
|
||||
if ( ifModifiedSinceValue &&
|
||||
mtime.getTime() != new Date(ifModifiedSinceValue).getTime()
|
||||
){
|
||||
return new Response(null, {
|
||||
status: Status.NotModified,
|
||||
statusText: STATUS_TEXT[Status.NotModified]
|
||||
})
|
||||
}
|
||||
// const ifModifiedSinceValue = req.headers.get("if-modified-since");
|
||||
// if ( ifModifiedSinceValue &&
|
||||
// mtime.getTime() <= new Date(ifModifiedSinceValue).getTime()
|
||||
// ){
|
||||
// return new Response(null, {
|
||||
// status: Status.NotModified,
|
||||
// statusText: STATUS_TEXT[Status.NotModified]
|
||||
// })
|
||||
// }
|
||||
return new Response(body, {headers});
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user