diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-12-22 14:14:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 14:14:23 +0100 |
commit | ddda669a02fa394627dda2ac3d7ea0ed8830b920 (patch) | |
tree | 40c1589bd9b8d54b1f0cc15e07e1012cface7e01 /op_crates/fetch | |
parent | 097c3379ba8a5dce5d9a73771693205d8178792d (diff) |
fix: implement ReadableStream fetch body handling (#8855)
Diffstat (limited to 'op_crates/fetch')
-rw-r--r-- | op_crates/fetch/26_fetch.js | 8 |
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); |