gecko-dev/testing/web-platform/tests/fetch/content-encoding/bad-gzip-body.any.js
Moritz Kneilmann 0b09173db2 Bug 1455457 [wpt PR 10542] - Add tests for handling bad content encoding in fetch, a=testonly
Automatic update from web-platform-testsFetch: handling bad gzip content

For https://github.com/whatwg/fetch/pull/710.
--

wpt-commits: 5ac29d88c701690eabc70dea4e467a4353d27541
wpt-pr: 10542
2018-04-30 14:36:03 +00:00

20 lines
585 B
JavaScript

promise_test((test) => {
return fetch("resources/bad-gzip-body.py").then(res => {
assert_equals(res.status, 200);
});
}, "Fetching a resource with bad gzip content should still resolve");
[
"arrayBuffer",
"blob",
"formData",
"json",
"text"
].forEach(method => {
promise_test(t => {
return fetch("resources/bad-gzip-body.py").then(res => {
assert_equals(res.status, 200);
return promise_rejects(t, new TypeError(), res[method]());
});
}, "Consuming the body of a resource with bad gzip content with " + method + "() should reject");
});