node-server
node-server copied to clipboard
Bug: `serveStatic({ precompressed: true })` returns `text/plain`
Environment
- [email protected] + @hono/[email protected]
- Windows + Node.js 22.13.1
Steps to reproduce
- Set
precompressed: trueforserveStatic() - Call
c.resas in the following code - Prepare the compressed file (e.g.
with-compressed.htmlandwith-compressed.html.br) - Content-Type is set to
text/plain;charset=UTF-8😥
app.use(
serveStatic({
root: "static",
precompressed: true,
onFound: (_path, c) => {
const { res } = c;
},
})
);
Minimal Reproducible Example
I have created MRE in the following repository. https://github.com/SaekiTominaga/mre-hono-static-compress-node
-
npm run dev1→http://localhost:3000/with-compressed.htmlreturnstext/html👍 -
npm run dev2→http://localhost:3000/with-compressed.htmlreturnstext/plain👎 -
npm test→ "called `c.res` – with compressed" test fails