summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/fetch/content-encoding/bad-gzip-body.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/wpt/tests/fetch/content-encoding/bad-gzip-body.any.js')
-rw-r--r--test/wpt/tests/fetch/content-encoding/bad-gzip-body.any.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/wpt/tests/fetch/content-encoding/bad-gzip-body.any.js b/test/wpt/tests/fetch/content-encoding/bad-gzip-body.any.js
new file mode 100644
index 0000000..17bc126
--- /dev/null
+++ b/test/wpt/tests/fetch/content-encoding/bad-gzip-body.any.js
@@ -0,0 +1,22 @@
+// META: global=window,worker
+
+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_js(t, TypeError, res[method]());
+ });
+ }, "Consuming the body of a resource with bad gzip content with " + method + "() should reject");
+});