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.

See:

Constructor

new (?body:Blob, ?init:ResponseInit)

new (?body:ArrayBufferView, ?init:ResponseInit)

new (?body:ArrayBuffer, ?init:ResponseInit)

new (?body:FormData, ?init:ResponseInit)

new (?body:URLSearchParams, ?init:ResponseInit)

new (?body:Dynamic, ?init:ResponseInit)

new (?body:String, ?init:ResponseInit)

Throws:

null

DOMError

Variables

read onlybodyUsed:Bool

read onlyheaders:Headers

Contains the Headers object associated with the response.

read onlyok:Bool

Contains a boolean stating whether the response was successful (status in the range 200-299) or not.

read onlyredirected:Bool

Indicates whether or not the response is the result of a redirect; that is, its URL list has more than one entry.

read onlystatus:Int

Contains the status code of the response (e.g., 200 for a success).

read onlystatusText:String

Contains the status message corresponding to the status code (e.g., OK for 200).

read onlytype:ResponseType

Contains the type of the response (e.g., basic, cors).

read onlyurl:String

Contains the URL of the response.

Methods

arrayBuffer ():Promise<ArrayBuffer>

Throws:

null

DOMError

blob ():Promise<Blob>

Throws:

null

DOMError

clone ():Response

Creates a clone of a Response object.

Throws:

null

DOMError

formData ():Promise<FormData>

Throws:

null

DOMError

json ():Promise<Dynamic>

Throws:

null

DOMError

text ():Promise<String>

Throws:

null

DOMError

Static methods

staticerror ():Response

Returns a new Response object associated with a network error.

@:value({ status : 302 })staticredirect (url:String, status:Int = 302):Response

Creates a new response with a different URL.

Throws:

null

DOMError