Response

open class Response(body: BodyInit? = definedExternally, init: ResponseInit = definedExternally) : Body(source)

The Response interface of the Fetch API represents the response to a request.

MDN Reference

Constructors

Link copied to clipboard
constructor(body: BodyInit? = definedExternally, init: ResponseInit = definedExternally)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The headers read-only property of the Response interface contains the Headers object associated with the response.

Link copied to clipboard
val ok: Boolean

The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.

Link copied to clipboard

The redirected read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.

Link copied to clipboard

The status read-only property of the Response interface contains the HTTP status codes of the response.

Link copied to clipboard

The statusText read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.

Link copied to clipboard

The type read-only property of the Response interface contains the type of the response. The type determines whether scripts are able to access the response body and headers.

Link copied to clipboard
val url: String

The url read-only property of the Response interface contains the URL of the response. The value of the url property will be the final URL obtained after any redirects.

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline suspend fun Body.blob(): Blob
Link copied to clipboard
Link copied to clipboard
suspend fun Body.byteArray(): ByteArray
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The clone() method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.

Link copied to clipboard
inline suspend fun Body.formData(): FormData
Link copied to clipboard
Link copied to clipboard
inline suspend fun Body.json(): JsAny?
Link copied to clipboard
Link copied to clipboard
inline suspend fun Body.text(): String
Link copied to clipboard