The Bodymixin of the Fetch API represents the body of the response/request, allowing you to declare what its content type is and how it should be handled.
Body is implemented by both Request and Response. This provides these objects with an associated body (a stream), a used flag (initially unset), and a MIME type (initially the empty byte sequence).
Takes a Response stream and reads it to completion. It returns a promise that resolves with a USVString (text). The response is always decoded using UTF-8.
Examples
The example below uses a simple fetch call to grab an image and display it in an <img> tag. You'll notice that since we are requesting an image, we need to run Body.blob() (Response implements body) to give the response its correct MIME type.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
1. From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
2. From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
3. This feature is behind the dom.streams.enabled preference and the javascript.options.streams preference. To change preferences in Firefox, visit about:config.
4. From version 28: this feature is behind the Experimental Web Platform Features preference.
Desktop
Mobile
Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
Android webview
Chrome for Android
Edge Mobile
Firefox for Android
Opera for Android
iOS Safari
Samsung Internet
Basic support
Full support
42
Full support
42
Full support
41
Disabled
Disabled From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
Full support
Yes
Full support
39
Full support
39
Full support
34
Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
Disabled This feature is behind the dom.streams.enabled preference and the javascript.options.streams preference. To change preferences in Firefox, visit about:config.
No support
No
Full support
39
?
Full support
52
Full support
52
?
No support
No
Disabled
No support
No
Disabled
Disabled This feature is behind the dom.streams.enabled preference and the javascript.options.streams preference. To change preferences in Firefox, visit about:config.
Disabled From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
Full support
Yes
Full support
39
Full support
39
Full support
34
Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
No support
No
Full support
29
Full support
29
Full support
28
Disabled
Disabled From version 28: this feature is behind the Experimental Web Platform Features preference.
Disabled From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
Full support
Yes
Full support
39
Full support
39
Full support
34
Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
No support
No
Full support
29
Full support
29
Full support
28
Disabled
Disabled From version 28: this feature is behind the Experimental Web Platform Features preference.
Disabled From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
Full support
Yes
Full support
39
Full support
39
Full support
34
Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
No support
No
Full support
29
Full support
29
Full support
28
Disabled
Disabled From version 28: this feature is behind the Experimental Web Platform Features preference.
Disabled From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
Full support
Yes
Full support
39
Full support
39
Full support
34
Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
No support
No
Full support
29
Full support
29
Full support
28
Disabled
Disabled From version 28: this feature is behind the Experimental Web Platform Features preference.
Disabled From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.
Full support
Yes
Full support
39
Full support
39
Full support
34
Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
No support
No
Full support
29
Full support
29
Full support
28
Disabled
Disabled From version 28: this feature is behind the Experimental Web Platform Features preference.
No support
No
No support
No
No support
No
Full support
Yes
No support
No
No support
No
No support
No
?
Legend
Full support
Full support
No support
No support
Compatibility unknown
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Thanks! Please check your inbox to confirm your subscription.
If you haven’t previously confirmed a subscription to a Mozilla-related newsletter you may have to do so. Please check your inbox or your spam filter for an email from us.