gossamer/request

Types

This Fetch API interface represents a resource request.

pub type Request

Values

pub fn array_buffer(
  request: Request,
) -> promise.Promise(array_buffer.ArrayBuffer)

Takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer.

pub fn body(
  request: Request,
) -> option.Option(
  readable_stream.ReadableStream(uint8_array.Uint8Array),
)

A simple getter used to expose a ReadableStream of the body contents.

pub fn body_used(request: Request) -> Bool

Stores a Boolean that declares whether the body has been used in a response yet.

pub fn bytes(
  request: Request,
) -> promise.Promise(uint8_array.Uint8Array)

Takes a Response stream and reads it to completion. It returns a promise that resolves with a Uint8Array.

pub fn cache(request: Request) -> String

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

pub fn clone(request: Request) -> Request
pub fn credentials(request: Request) -> String

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.

pub fn destination(request: Request) -> String

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

pub fn headers(request: Request) -> headers.Headers

Returns a Headers object consisting of the headers associated with request.

pub fn integrity(request: Request) -> String

Returns request’s subresource integrity metadata.

pub fn is_history_navigation(request: Request) -> Bool

Returns a boolean indicating whether or not request is for a history navigation (a.k.a. back-forward navigation).

pub fn is_reload_navigation(request: Request) -> Bool

Returns a boolean indicating whether or not request is for a reload navigation.

pub fn json(request: Request) -> promise.Promise(dynamic.Dynamic)

Takes a Response stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as JSON.

pub fn keepalive(request: Request) -> Bool

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

pub fn method(request: Request) -> String

Returns request’s HTTP method, which is “GET” by default.

pub fn mode(request: Request) -> String

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.

pub fn new(input: String) -> Request
pub fn new_with_init(
  input: String,
  init: List(request_init.RequestInit),
) -> Request
pub fn redirect(request: Request) -> String

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

pub fn referrer(request: Request) -> String

Returns the referrer of request.

pub fn referrer_policy(request: Request) -> String

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

pub fn signal(request: Request) -> abort_signal.AbortSignal

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

pub fn text(request: Request) -> promise.Promise(String)

Takes a Response stream and reads it to completion. It returns a promise that resolves with a USVString (text).

pub fn url(request: Request) -> String

Returns the URL of request as a string.

Search Document