Request.bodyUsed
The read-only bodyUsed
property of the Request
interface is a boolean value that indicates whether the request body has been read yet.
Syntax
request.bodyUsed;
Value
A boolean value.
Examples
const request = new Request('/myEndpoint', { method: 'POST', body: 'Hello world' }); request.bodyUsed; // false request.text().then(function(bodyAsText) { console.log(request.bodyUsed); // true });
Specifications
Specification |
---|
Fetch Standard (Fetch) # ref-for-dom-body-bodyused① |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
bodyUsed |
42 |
14 |
39 |
No |
29 |
10.1 |
42 |
42 |
39 |
29 |
10.3 |
4.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Request/bodyUsed