Request

open external class Request(input: Request, init: RequestInit = definedExternally) : Body(source)

This Fetch API interface represents a resource request.

MDN Reference

Constructors

Link copied to clipboard
constructor(input: String, init: RequestInit = definedExternally)
constructor(input: URL, init: RequestInit = definedExternally)
constructor(input: Request, init: RequestInit = definedExternally)

Properties

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

Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.

Link copied to clipboard

Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.

Link copied to clipboard

Returns the kind of resource requested by request, e.g., "document" or "script".

Link copied to clipboard

Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

Link copied to clipboard

Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. SRI

Link copied to clipboard

Returns a boolean indicating whether or not request can outlive the global in which it was created.

Link copied to clipboard

Returns request's HTTP method, which is "GET" by default.

Link copied to clipboard

Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs.

Link copied to clipboard

Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.

Link copied to clipboard

Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the Referer header of the request being made.

Link copied to clipboard

Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer.

Link copied to clipboard

Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.

Link copied to clipboard
val url: String

Returns the URL of request as a string.

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open suspend fun blob(): Blob
Link copied to clipboard
open fun blobAsync(): Promise<Blob>
Link copied to clipboard
open suspend fun bytes(): Uint8Array<*>
Link copied to clipboard
open fun bytesAsync(): Promise<Uint8Array<*>>
Link copied to clipboard
Link copied to clipboard
open suspend fun formData(): FormData
Link copied to clipboard
Link copied to clipboard
open suspend fun json(): Any?
Link copied to clipboard
open fun jsonAsync(): Promise<*>
Link copied to clipboard
open suspend fun text(): String
Link copied to clipboard
open fun textAsync(): Promise<String>