Skip to main content

Crate ferrijs_fetch

Crate ferrijs_fetch 

Source
Expand description

A spec-faithful WHATWG Fetch model and the single send engine over reqwest. A JS fetch global and a host’s own HTTP client API both marshal into the same Request, go through the same send path, and read back the same Response — there is no second code path.

Layout:

  • headers — the WHATWG header list.
  • body — request/response body (Empty / Bytes / stream).
  • modelRequest / Response + the RedirectMode / Credentials / ResponseType enums and RemoteAddr.
  • error — the typed FetchError.
  • engine — the client pool and the one manual-redirect send loop.
  • net_guard — SSRF policy (allow-list, metadata/private blocking).
  • cookie — RFC 6265 parsing/matching for the context-bound path.
  • multipartmultipart/form-data serialization and parsing.
  • bridge — the two-way cookie/defaults bridge to a host-owned jar (a browser context, a session store).
  • cookie also carries the Cookie record that bridge speaks.

Re-exports§

pub use body::Body;
pub use body::ByteStream;
pub use body::channel_stream;
pub use bridge::BridgeFuture;
pub use bridge::ContextBridge;
pub use bridge::ContextDefaults;
pub use cookie::Cookie;
pub use cookie::SameSite;
pub use error::FetchError;
pub use headers::Headers;
pub use model::Credentials;
pub use model::RedirectMode;
pub use model::RemoteAddr;
pub use model::Request;
pub use model::Response;
pub use model::ResponseType;
pub use multipart::MultipartField;
pub use multipart::MultipartValue;
pub use multipart::multipart_boundary;
pub use multipart::multipart_boundary_of;
pub use multipart::parse_multipart;
pub use multipart::serialize_multipart;
pub use net_guard::GuardError;
pub use net_guard::NetGuard;
pub use net_guard::NetPolicy;
pub use net_guard::check_url;
pub use net_guard::preflight;
pub use engine::ClientPool;
pub use engine::send;
pub use reqwest;

Modules§

body
Request / response body.
bridge
Two-way bridge between the engine and a host-owned cookie jar.
cookie
RFC 6265 cookie parsing and matching for the bridged request path. Ported from Playwright’s server/cookieStore.ts + server/fetch.ts cookie handling: the host’s context is the jar, so the outgoing Cookie header is assembled here from its cookies and every hop’s Set-Cookie is parsed back with the same defaults Playwright applies.
engine
The one send engine.
error
Typed error for the fetch engine.
headers
WHATWG header list.
model
The WHATWG request/response model the engine sends and returns.
multipart
multipart/form-data serialization, shared by the request-option lowering and the JS FormData body path so both express multipart identically. Mirrors Playwright’s FormField.
net_guard
Sandbox network guard (SSRF defense).