Skip to content

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

@SaekiTominaga

Description

@SaekiTominaga

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. with-compressed.html and with-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/with-compressed.html returns text/html 👍
  • npm run dev2http://localhost:3000/with-compressed.html returns text/plain 👎
  • npm test → "called `c.res` – with compressed" test fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions