From f4e9e7545846e2052d75c5537c2b9c540dfe51da Mon Sep 17 00:00:00 2001 From: Michael Hart Date: Thu, 19 Sep 2024 15:12:38 +1000 Subject: [PATCH] BodyInit also allows ReadableStream See relevant section of the spec: https://fetch.spec.whatwg.org/#bodyinit-unions --- files/en-us/web/api/fetch_api/using_fetch/index.md | 1 + files/en-us/web/api/requestinit/index.md | 1 + 2 files changed, 2 insertions(+) diff --git a/files/en-us/web/api/fetch_api/using_fetch/index.md b/files/en-us/web/api/fetch_api/using_fetch/index.md index 261f25b1a7dd969..269d504765fd234 100644 --- a/files/en-us/web/api/fetch_api/using_fetch/index.md +++ b/files/en-us/web/api/fetch_api/using_fetch/index.md @@ -89,6 +89,7 @@ You can supply the body as an instance of any of the following types: - {{domxref("File")}} - {{domxref("URLSearchParams")}} - {{domxref("FormData")}} +- {{domxref("ReadableStream")}} Note that just like response bodies, request bodies are streams, and making the request reads the stream, so if a request contains a body, you can't make it twice: diff --git a/files/en-us/web/api/requestinit/index.md b/files/en-us/web/api/requestinit/index.md index d39a419b2221fc1..f2e33f1bb8e6712 100644 --- a/files/en-us/web/api/requestinit/index.md +++ b/files/en-us/web/api/requestinit/index.md @@ -38,6 +38,7 @@ You can also construct a `Request` with a `RequestInit`, and pass the `Request` - {{domxref("FormData")}} - {{jsxref("TypedArray")}} - {{domxref("URLSearchParams")}} + - {{domxref("ReadableStream")}} See [Setting a body](/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_a_body) for more details.