Expand description

Fetch API.

Seed Fetch API is very similar to the browser native one.

There is one entry point: fetch function. It can accept both string urls as well as Request.

To get a Response you need to .await fetch:

let response = fetch("/foo").await?;

Then you can check Status and extract body in various formats:

let response = fetch("/foo").await?.check_status()?;
let body: FooStruct = response.json().await?;

Use Request methods to set init options:

fetch(Request::new(url).method(Method::Post)).await

Re-exports

pub use form_data::FormData;
pub use header::Header;
pub use header::Headers;

Modules

Provides a simplified (and incomplete) interface to the FormData Web API, in order to facilitate the creation of multipart request bodies for seed’s Fetch API.

HTTP headers

Structs

Its methods configure the request, and handle the response. Many of them return the original struct, and are intended to be used chained together.

It allows to abort request or disable request’s timeout. You can get it by calling method Request.controller.

Response of the fetch request. To get one you need to use fetch function.

Response status.

Enums

Functions

The main Fetch API function. It fires a HTTP request.

Type Definitions

Convenient type alias.