Response
The Response interface of the Fetch API represents the response to a request.
Documentation Response by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Static Members
error(): ResponseReturns a new Response object associated with a network error.
| Returns |
|---|
| Response |
Creates a new response with a different URL.
| Name | Type | Default |
|---|---|---|
url |
String | |
status |
Int | 302 |
| Returns |
|---|
| Response |
Instance Members
type: ResponseTypeContains the type of the response (e.g., basic, cors).
url: StringContains the URL of the response.
redirected: BoolIndicates whether or not the response is the result of a redirect; that is, its URL list has more than one entry.
status: IntContains the status code of the response (e.g., 200 for a success).
ok: BoolContains a boolean stating whether the response was successful (status in the range 200-299) or not.
statusText: StringContains the status message corresponding to the status code (e.g., OK for 200).
headers: HeadersContains the Headers object associated with the response.
bodyUsed: Boolclone(): ResponseCreates a clone of a Response object.
| Returns |
|---|
| Response |
arrayBuffer(): js.lib.Promise<js.lib.ArrayBuffer>| Returns |
|---|
| js.lib.Promise<js.lib.ArrayBuffer> |
blob(): js.lib.Promise<Blob>| Returns |
|---|
| js.lib.Promise<Blob> |
formData(): js.lib.Promise<FormData>| Returns |
|---|
| js.lib.Promise<FormData> |
json(): js.lib.Promise<Dynamic>| Returns |
|---|
| js.lib.Promise<Dynamic> |
text(): js.lib.Promise<String>| Returns |
|---|
| js.lib.Promise<String> |
new(?body: Blob, ?init: Null<ResponseInit>): Void| Name | Type | Default |
|---|---|---|
body |
Blob | (optional) |
init |
Null<ResponseInit> | (optional) |