Skip to content

🐛 BUG: Brotli response not decoded #1587

Open
@hansottowirtz

Description

@hansottowirtz

Which Cloudflare product(s) does this pertain to?

Miniflare

What version(s) of the tool(s) are you using?

^3.20231218.4

What version of Node are you using?

18.19.0

What operating system are you using?

Mac

Describe the Bug

The result of res.text() of a response with content-encoding: br is not decoded, but when it is gzip, it is correctly decoded.

This worker returns a mess:

export default {
  async fetch() {
    const res = await fetch("https://blog.cloudflare.com/this-is-brotli-from-origin", {
      headers: {
        "accept-encoding": "br, gzip, deflate"
      }
    });
    return new Response(await res.text(), {
      headers: {
        "content-type": "text/html"
      }
    });
  }
}

This worker returns the correct HTML:

export default {
  async fetch() {
    const res = await fetch("https://blog.cloudflare.com/this-is-brotli-from-origin", {
      headers: {
        "accept-encoding": "gzip, deflate"
      }
    });
    return new Response(await res.text(), {
      headers: {
        "content-type": "text/html"
      }
    });
  }
}

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequest for Workers team to add a feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions