mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(ext/fetch): blob url (#16057)
Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
parent
a3b4037c8a
commit
7a47321b09
2 changed files with 21 additions and 1 deletions
|
@ -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");
|
||||
},
|
||||
);
|
||||
|
|
|
@ -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)],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue