This commit is contained in:
parent
cebf8feb6a
commit
784c1c1c56
1 changed files with 5 additions and 1 deletions
|
@ -44,10 +44,14 @@ const Responses = {
|
|||
return new Response(Bun.gzipSync(JSON.stringify(data)), respOptions);
|
||||
},
|
||||
file: async (file: Bun.BunFile) => {
|
||||
const isHTML = file.type === "text/html";
|
||||
|
||||
return new Response(Bun.gzipSync(await file.arrayBuffer()), {
|
||||
headers: {
|
||||
"Content-Type": file.type,
|
||||
"Cache-Control": "public, max-age=31536000",
|
||||
...(isHTML
|
||||
? { "Cache-Control": "no-cache" }
|
||||
: { "Cache-Control": "public, max-age=31536000" }),
|
||||
"Content-Encoding": "gzip",
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue