Web APIs

Response.body

Try the free JavaScript compiler

Expose the response body as a readable byte stream, or null for a bodyless response. Reading through a reader consumes the body. Example console output: true true.

Formal Syntax & Structure

javascript syntaxjavascript
response.body

Return Value

ReadableStream or null

Body stream if present.

Working Example

Example Snippetjavascript
const r=new Response("a"); console.log(r.body instanceof ReadableStream,new Response(null,{status:204}).body===null);
JavaScript Reference