diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.ts | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/app.ts b/src/app.ts index 8d08e0b..7d5e448 100644 --- a/src/app.ts +++ b/src/app.ts @@ -34,7 +34,6 @@ type File = { filename: string; handle: BunFile; relPath: string; - headers?: Record<string, string>; type: string; size: number; mtime: Date; @@ -80,10 +79,6 @@ async function registerFile( relPath: "/" + path, handle: handle, type: pathname.startsWith("/feed-styles.xsl") ? "text/xsl" : handle.type, - headers: - pathname === "/404.html" - ? Object.assign({}, defaultHeaders, { "cache-control": "no-cache" }) - : undefined, size: stat.size, mtime: stat.mtime, etag: `W/"${await hashFile(handle)}"`, @@ -116,7 +111,7 @@ async function serveFile( headers: { "last-modified": file.mtime.toUTCString(), ...extraHeaders, - ...(file.headers || defaultHeaders), + ...defaultHeaders, }, status: statusCode, }); @@ -238,6 +233,7 @@ export const server = { if (!request.headers.get("accept")?.split(",").includes("text/html")) { return new Response("404 Not Found", { status, + headers: defaultHeaders, }); } if (notfound) { |