Request
The Request
interface of the Fetch API represents a resource request.
Documentation Request by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Instance Members
method: String
Contains the request's method (GET
, POST
, etc.)
url: String
Contains the URL of the request.
headers: Headers
Contains the associated Headers
object of the request.
destination: RequestDestination
Returns a string from the RequestDestination
enum describing the request's destination. This is a string indicating the type of content being requested.
referrer: String
Contains the referrer of the request (e.g., client
).
referrerPolicy: ReferrerPolicy
Contains the referrer policy of the request (e.g., no-referrer
).
mode: RequestMode
Contains the mode of the request (e.g., cors
, no-cors
, same-origin
, navigate
.)
credentials: RequestCredentials
Contains the credentials of the request (e.g., "omit"
, "same-origin"
, "include"
). The default is "same-origin"
.
cache: RequestCache
Contains the cache mode of the request (e.g., default
, reload
, no-cache
).
redirect: RequestRedirect
Contains the mode for how redirects are handled. It may be one of follow
, error
, or manual
.
integrity: String
Contains the subresource integrity value of the request (e.g., sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=
).
signal: AbortSignal
bodyUsed: Bool
clone(): Request
Creates a copy of the current Request
object.
Returns |
---|
Request |
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(input: Request, ?init: Null<RequestInit>): Void
Name | Type | Default |
---|---|---|
input |
Request | |
init |
Null<RequestInit> | (optional) |