Skip to main content

Module http

Module http 

Source
Expand description

The Fetch API’s types, as the routes and everything that calls out use them: Request, Response, Headers, URL, URLSearchParams, and an injected fetch.

Structs§

FetchInit
What a request is sent with, the keys fetch’s init takes where they apply.
Headers
Header names matched without regard to case, as the Fetch API’s Headers are. get joins repeated values with ", "; Set-Cookie is kept apart, since its values may hold commas, and read back with get_set_cookie.
NoFetcher
A Fetcher that fails every request, for a build without transport.
Request
An incoming request, shaped like the Fetch API’s Request so the routes read as the TypeScript SDK’s do: an absolute URL, a method, headers, the body already read, and the address the connection came from (an adapter’s RequestContext.ip), before any proxy header is read.
ReqwestFetcher
The default Fetcher: reqwest, on rustls with the platform’s roots.
Response
An answer: a status, headers, and the whole body.
SearchParams
Query parameters as URLSearchParams reads and writes them: pairs kept in order, + read as a space, bytes that are not UTF-8 read as U+FFFD, and written back in the application/x-www-form-urlencoded form.
Url
A parsed URL, as new URL(input, base) makes one.

Enums§

FetchError
No answer came back: refused, timed out, bad TLS, or a body past its cap.

Traits§

Fetcher
Everything that calls another server (mail services, importers, connected installs, the assistant’s providers, site icons) goes through one, so tests and apps can pass their own.

Functions§

default_fetcher
The Fetcher used when none is given: ReqwestFetcher with the transport feature, else one that fails every request.
utf8
Text as TextDecoder gives it: U+FFFD where the bytes are not UTF-8, and no byte order mark.

Type Aliases§

SharedFetcher
A shared Fetcher.