Back to Content

Request: body property

files/en-us/web/api/request/body/index.md

latest713 B
Original Source

{{APIRef("Fetch API")}}{{AvailableInWorkers}}

The body read-only property of the {{domxref("Request")}} interface contains a {{domxref("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 {{domxref("ReadableStream")}} or null.

Examples

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

request.body; // ReadableStream

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("Request.bodyUsed")}}