MDN self-hosted library · e01.org

Request: bodyUsed property

Fetch API

Open notebook · 1 cells web-api-instance-property upstream source

Fetch API

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

Value

A boolean value.

Examples

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

See also

  • Request.body