aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/js/web/fetch/fetch.test.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/js/web/fetch/fetch.test.ts b/test/js/web/fetch/fetch.test.ts
index aa44ee76a..4ef5d7bba 100644
--- a/test/js/web/fetch/fetch.test.ts
+++ b/test/js/web/fetch/fetch.test.ts
@@ -93,6 +93,30 @@ describe("fetch data urls", () => {
expect(blob.type).toBe("text/plain;charset=utf-8");
expect(blob.text()).resolves.toBe("helloworld!");
});
+ it("unstrict parsing of invalid URL characters", async () => {
+ var url = "data:application/json,{%7B%7D}";
+ var res = await fetch(url);
+ expect(res.status).toBe(200);
+ expect(res.statusText).toBe("OK");
+ expect(res.ok).toBe(true);
+
+ var blob = await res.blob();
+ expect(blob.size).toBe(4);
+ expect(blob.type).toBe("application/json;charset=utf-8");
+ expect(blob.text()).resolves.toBe("{{}}");
+ });
+ it("unstrict parsing of double percent characters", async () => {
+ var url = "data:application/json,{%%7B%7D%%}%%";
+ var res = await fetch(url);
+ expect(res.status).toBe(200);
+ expect(res.statusText).toBe("OK");
+ expect(res.ok).toBe(true);
+
+ var blob = await res.blob();
+ expect(blob.size).toBe(9);
+ expect(blob.type).toBe("application/json;charset=utf-8");
+ expect(blob.text()).resolves.toBe("{%{}%%}%%");
+ });
it("data url (invalid)", async () => {
var url = "data:Hello%2C%20World!";
expect(async () => {