-
Notifications
You must be signed in to change notification settings - Fork 340
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
Define how to handle bad content encoding #657
Comments
Seems like the relevant spec section is this:
I guess there are a few things of interest here:
The error handling of the specific body consumption methods ( |
Thanks for creating a test, that's great! Safari and the polyfill seem like the most consistent. That is, if |
I'd prefer the majority behavior (response fulfills but body consumption fails). This specific WPT has the broken content-encoding right from the beginning, but in practice the broken content-encoding may not happen until we are already megabytes into the response. If we don't buffer that much there's no way it can be discovered at |
Aah I see. Yes, that makes sense. Thanks! |
I think there is also value in getting the response of a request with a corrupted body. For example you could check the status code or headers. I think failing because of a corrupted body before actually using the body would be patronizing. |
Tests: web-platform-tests/wpt#10542. Follow-up: #716. Fixes #657.
Why didn't you add the test to https://github.com/web-platform-tests/wpt/tree/master/fetch/api/basic ? |
Because in web-platform-tests/wpt#10542 I decided it should be elsewhere. |
@annevk I see that but in web-platform-tests/wpt@9d8baef you removed |
How is |
@annevk I must be missing your point. I was under the impression that all tests had a corresponding html page. I managed to do my own, but it sure would have been more convenient to have the html page handy. |
There is a corresponding HTML page (several corresponding HTML pages actually) — but instead of being under version control, the HTML is generated by the (self-hosted) web server for the test suite: http://web-platform-tests.live/fetch/content-encoding/bad-gzip-body.any.html See the related documentation here: https://web-platform-tests.org/writing-tests/testharness.html#multi-global-tests |
I recognized some inconsistencies in the way different fetch implementations handle bad content encoding and couldn't find a clear definition of how to handle it in the spec.
I created a web-platform-tests to track the different behaviors:
TypeError
("TypeError: Network request failed")ArrayBuffer
1TypeError
TypeError
AbortError
TypeError
Blob
1TypeError
TypeError
AbortError
TypeError
TypeError
TypeError
AbortError
"Not implemented"
TypeError
TypeError
TypeError
AbortError
SyntaxError
TypeError
TypeError
TypeError
AbortError
TypeError
1 In Safari the
Promise
returned by fetching a resource with bad content encoding only fulfills if it get executed immediately during the load. Otherwise it will never fulfill.2 Only rejects because an empty string isn't valid JSON ("Syntax Error: (DOM Exception 12): The string did not match the expected pattern.").
The text was updated successfully, but these errors were encountered: