summaryrefslogtreecommitdiff
path: root/op_crates/fetch
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-12-22 14:14:23 +0100
committerGitHub <noreply@github.com>2020-12-22 14:14:23 +0100
commitddda669a02fa394627dda2ac3d7ea0ed8830b920 (patch)
tree40c1589bd9b8d54b1f0cc15e07e1012cface7e01 /op_crates/fetch
parent097c3379ba8a5dce5d9a73771693205d8178792d (diff)
fix: implement ReadableStream fetch body handling (#8855)
Diffstat (limited to 'op_crates/fetch')
-rw-r--r--op_crates/fetch/26_fetch.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/op_crates/fetch/26_fetch.js b/op_crates/fetch/26_fetch.js
index 95ee96812..0835e12a1 100644
--- a/op_crates/fetch/26_fetch.js
+++ b/op_crates/fetch/26_fetch.js
@@ -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);