Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: serveStatic({ precompressed: true }) returns text/plain #226

Open
SaekiTominaga opened this issue Feb 9, 2025 · 0 comments
Open

Bug: serveStatic({ precompressed: true }) returns text/plain #226

SaekiTominaga opened this issue Feb 9, 2025 · 0 comments

Comments

@SaekiTominaga
Copy link

Environment

Steps to reproduce

  1. Set precompressed: true for serveStatic()
  2. Call c.res as in the following code
  3. Prepare the compressed file (e.g. width-compressed.html and width-compressed.html.br)
  4. 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 dev1http://localhost:3000/width-compressed.html returns text/html 👍
  • npm run dev2http://localhost:3000/width-compressed.html returns text/plain 👎
  • npm test → "called `c.res` – width compressed" test fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant