cypress: Brotli encoding request fails (ERR_CONTENT_DECODING_FAILED)
Requests with encoding content by Brotli compression algorithm always fails.
Current behavior:
Request header:
Accept-Encoding: gzip, deflate, br
Response header:
content-encoding: br
Result:
Request has status 200 OK, but failed with an error ERR_CONTENT_DECODING_FAILED
.
Desired behavior:
Request header:
Accept-Encoding: gzip, deflate, br
Response header:
content-encoding: br
Result: Request 200 OK. Files successfully decoded.
Test code to reproduce
Start any tests on project, where files are encoded with Brotli algorithm. Use any browser and method to run the tests.
Versions
Requests began to fail, when the encoding of our files was changed (2 month ago) In the last version of Cypress (3.8.2) bug also exists and could be reproduced in any browser.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 10
- Comments: 19 (4 by maintainers)
I tested those behaviors inspecting my own server. Some notes:
as @flotwig said: cypress will transform any
accept-encoding
header containing “gzip” to just “gzip”, stripping away everythingdo not trust the network tab of the browser inside the cypress test! This is discussed on other issues:
If you look at the network tab only it seems to not be working, but headers are changed someway after. To do some real tests inspect the server side received headers
I did not find any workaround for this specific issue: using
headers
option ofvisit()
is not working for the following reason:accept-encoding
, for the reason at point 1.Side note: although I highly hope that cypress will introduce brotli support (we are in 2022… and today is the second birthday of this issue 🥳 🥳 🥳 🥳 ) if this behavior is leading any issue to your tests, you have (probably) a proxy cache issue: you should provide both brotli and gzip content.
any updates on this??? I have a more specific scenario. My page using an npm which load a js file which is Brotli encoding. Then it failed with ERR_CONTENT_DECODING_FAILED, and I have no way to change the head of the request
I’m looking at the headers of the cy.visit() request and it contains:
Accept-Encoding: gzip, deflate, br
Following-up on this since we’re bumping into the same issue.
@egemon How did you work around it?