#1454·fetch

Response.body is always undefined

Author: joshmossas-oldCreated May 7, 2024Updated Oct 30, 2025

The fetch standard says that response.body should be null or a body.

https://fetch.spec.whatwg.org/#responses

A response has an associated body (null or a body). Unless stated otherwise it is null.

However this polyfill never sets the body field in Response so it's always undefined. This causes downstream issues for applications that might use response.body to check if a response body exists.

Proposed Change

In fetch.js line 238

https://github.com/JakeChampion/fetch/blob/ba5cf1ed2e02ebb96fa1e60b4fd2eb04071b60e4/fetch.js#L238

assign the body field

typescript
this._bodyInit = body
this.body = body ?? null

I'm willing to open a PR if this proposal looks good to you.