This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Note: This feature is available in Web Workers.
The Response() constructor creates a new Response object.
new Response() new Response(body) new Response(body, options)
body OptionalAn object defining a body for the response. This can be null (which is the default value), or one of:
BlobArrayBufferTypedArrayDataViewFormDataReadableStreamURLSearchParamsStringoptions OptionalAn options object containing any custom settings that you want to apply to the response, or an empty object (which is the default value). The possible options are:
statusThe status code for the response. The default value is 200.
statusTextThe status message associated with the status code, such as "OK". The default value is "".
headersAny headers you want to add to your response, contained within a Headers object or object literal of String key/value pairs (see HTTP headers for a reference). By default this is empty.
In our Fetch Response example (see Fetch Response live) we create a new Response object using the constructor, passing it a new Blob as a body, and an init object containing a custom status and statusText:
const myBlob = new Blob();
const myOptions = { status: 200, statusText: "SuperSmashingGreat!" };
const myResponse = new Response(myBlob, myOptions);
| Specification |
|---|
| Fetch> # ref-for-dom-response①> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Response |
40 | 14 | 39 | 27 | 10.1 | 40 | 39 | 27 | 10.3 | 4.0 | 40 | 10.3 |
accept_readablestream |
52 | 79 | 39 | 39 | 10.1 | 52 | 39 | 41 | 10.3 | 6.0 | 52 | 10.3 |
body_parameter_optional |
40 | 79 | 59 | 27 | 10.1 | 40 | 59 | 27 | 10.3 | 4.0 | 40 | 10.3 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Response/Response