The read-only bodyUsed
property of the Request
interface is a boolean value that indicates whether the request body has been read yet.
The read-only bodyUsed
property of the Request
interface is a boolean value that indicates whether the request body has been read yet.
A boolean value.
js
const request = new Request("/myEndpoint", { method: "POST", body: "Hello world", }); request.bodyUsed; // false request.text().then((bodyAsText) => { console.log(request.bodyUsed); // true });
Specification |
---|
Fetch Standard # ref-for-dom-body-bodyused① |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
bodyUsed |
42 | 14 | 39 | No | 29 | 10.1 | 42 | 42 | 39 | 29 | 10.3 | 4.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Request/bodyUsed