W3cubDocs

/Haxe JavaScript

Response

package js.html

@:native("Response") Available on js

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:EitherType<ArrayBuffer, EitherType<ArrayBufferView, EitherType<Blob, EitherType<FormData, EitherType<String, URLSearchParams>>>>>, ?init:ResponseInit)

Throws:

null DOMError

Variables

read only bodyUsed:Bool

read only headers:Headers

Contains the Headers object associated with the response.

read only ok:Bool

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

read only status:Int

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

read only statusText:String

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

read only type:ResponseType

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

read only url:String

Contains the URL of the response.

Methods

arrayBuffer ():Promise<ArrayBuffer>

Throws:

null DOMError

blob ():Promise<Blob>

Throws:

null DOMError

clone ():Response

Throws:

null DOMError

formData ():Promise<FormData>

Throws:

null DOMError

json ():Promise<Dynamic>

Throws:

null DOMError

text ():Promise<String>

Throws:

null DOMError

Static methods

static error ():Response

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

Throws:

null DOMError

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/Response.html