AwaitedDOM / Body
The
Body mixin 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).Properties
.bodyUsed W3C {#bodyUsed}
A boolean that indicates whether the body has been read.
Type: Promise<boolean>
Methods
.arrayBuffer*()* W3C {#arrayBuffer}
Takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer.
Returns: Promise<ArrayBuffer>
.json*()* W3C {#json}
Takes a Response stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as JSON.
Returns: Promise<any>
.text*()* W3C {#text}
Takes a Response stream and reads it to completion. It returns a promise that resolves with a string (text). The response is always decoded using UTF-8.
Returns: Promise<string>
Unimplemented Specs
Properties
body |
Methods
blob() | formData() |