MDN self-hosted library · e01.org

Request: body property

Fetch API

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

Fetch API

The body read-only property of the Request interface contains a ReadableStream with the body contents that have been added to the request. Note that a request using the GET or HEAD method cannot have a body and null is returned in these cases.

Value

A ReadableStream or null.

Examples

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

request.body; // ReadableStream

Specifications

Browser compatibility

See also

  • Request.bodyUsed