diff --git a/fetch/content-encoding/gzip-body.any.js b/fetch/content-encoding/gzip-body.any.js new file mode 100644 index 00000000000000..37758b7d91775f --- /dev/null +++ b/fetch/content-encoding/gzip-body.any.js @@ -0,0 +1,16 @@ +// META: global=window,worker + +const expectedDecompressedSize = 10500; +[ + "text", + "octetstream" +].forEach(contentType => { + promise_test(async t => { + let response = await fetch(`resources/foo.${contentType}.gz`); + assert_true(response.ok); + let arrayBuffer = await response.arrayBuffer() + let u8 = new Uint8Array(arrayBuffer); + assert_equals(u8.length, expectedDecompressedSize); + }, `fetched gzip data with content type ${contentType} should be decompressed.`); +}); + diff --git a/fetch/content-encoding/resources/foo.octetstream.gz b/fetch/content-encoding/resources/foo.octetstream.gz new file mode 100644 index 00000000000000..f3df4cb89b5d0b Binary files /dev/null and b/fetch/content-encoding/resources/foo.octetstream.gz differ diff --git a/fetch/content-encoding/resources/foo.octetstream.gz.headers b/fetch/content-encoding/resources/foo.octetstream.gz.headers new file mode 100644 index 00000000000000..27d4f401f1b601 --- /dev/null +++ b/fetch/content-encoding/resources/foo.octetstream.gz.headers @@ -0,0 +1,2 @@ +Content-type: application/octet-stream +Content-Encoding: gzip diff --git a/fetch/content-encoding/resources/foo.text.gz b/fetch/content-encoding/resources/foo.text.gz new file mode 100644 index 00000000000000..05a5cce07b5143 Binary files /dev/null and b/fetch/content-encoding/resources/foo.text.gz differ diff --git a/fetch/content-encoding/resources/foo.text.gz.headers b/fetch/content-encoding/resources/foo.text.gz.headers new file mode 100644 index 00000000000000..7def3ddc148d1c --- /dev/null +++ b/fetch/content-encoding/resources/foo.text.gz.headers @@ -0,0 +1,2 @@ +Content-type: text/plain +Content-Encoding: gzip