From 7a47321b091de3693dcd5a433d2c1dd3c66727ba Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Tue, 27 Sep 2022 22:07:46 +0530 Subject: fix(ext/fetch): blob url (#16057) Co-authored-by: Luca Casonato --- cli/tests/unit/fetch_test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cli/tests/unit') diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 5375457bc..7a531392d 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -1773,3 +1773,20 @@ Deno.test( listener.close(); }, ); + +Deno.test( + { permissions: { net: true } }, + async function fetchBlobUrl(): Promise< + void + > { + const blob = new Blob(["ok"], { type: "text/plain" }); + const url = URL.createObjectURL(blob); + const res = await fetch(url); + console.log(res); + assert(res.url.startsWith("blob:http://js-unit-tests/")); + assertEquals(res.status, 200); + assertEquals(res.headers.get("content-length"), "2"); + assertEquals(res.headers.get("content-type"), "text/plain"); + assertEquals(await res.text(), "ok"); + }, +); -- cgit v1.2.3