W3cubDocs

/Web APIs

Request: bodyUsed property

The read-only bodyUsed property of the Request interface is a boolean value that indicates whether the request body has been read yet.

Value

A boolean value.

Examples

js

const request = new Request("/myEndpoint", {
  method: "POST",
  body: "Hello world",
});

request.bodyUsed; // false

request.text().then((bodyAsText) => {
  console.log(request.bodyUsed); // true
});

Specifications

Browser compatibility

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

See also

© 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