diff options
author | Satya Rohith <me@satyarohith.com> | 2022-09-27 22:07:46 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 22:07:46 +0530 |
commit | 7a47321b091de3693dcd5a433d2c1dd3c66727ba (patch) | |
tree | 9ffd77d9fcc475f952101c74634138a77f5ef1e9 | |
parent | a3b4037c8add96b437be37f36728ea86882100a4 (diff) |
fix(ext/fetch): blob url (#16057)
Co-authored-by: Luca Casonato <hello@lcas.dev>
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 17 | ||||
-rw-r--r-- | ext/fetch/26_fetch.js | 5 |
2 files changed, 21 insertions, 1 deletions
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"); + }, +); diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index 13c34f534..3e90429ce 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -165,6 +165,7 @@ const body = new InnerBody(req.blobUrlEntry.stream()); terminator[abortSignal.add](() => body.error(terminator.reason)); + processUrlList(req.urlList, req.urlListProcessed); return { headerList: [ @@ -179,7 +180,9 @@ if (this.urlList.length == 0) return null; return this.urlList[this.urlList.length - 1]; }, - urlList: recursive ? [] : [...new SafeArrayIterator(req.urlList)], + urlList: recursive + ? [] + : [...new SafeArrayIterator(req.urlListProcessed)], }; } |