mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
fix: implement ReadableStream fetch body handling (#8855)
This commit is contained in:
parent
097c3379ba
commit
ddda669a02
2 changed files with 46 additions and 2 deletions
|
@ -1246,8 +1246,12 @@
|
|||
body = multipartBuilder.getBody();
|
||||
contentType = multipartBuilder.getContentType();
|
||||
} else {
|
||||
// TODO: ReadableStream
|
||||
throw new Error("Not implemented");
|
||||
// TODO(lucacasonato): do this in a streaming fashion once we support it
|
||||
const buf = new Buffer();
|
||||
for await (const chunk of init.body) {
|
||||
buf.write(chunk);
|
||||
}
|
||||
body = buf.bytes();
|
||||
}
|
||||
if (contentType && !headers.has("content-type")) {
|
||||
headers.set("content-type", contentType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue