ferrijs_fetch/lib.rs
1//! A spec-faithful WHATWG Fetch model and the single send engine over
2//! reqwest. A JS `fetch` global and a host's own HTTP client API both
3//! marshal into the same [`Request`], go through the same [`send`] path,
4//! and read back the same [`Response`] — there is no second code path.
5//!
6//! Layout:
7//! - [`headers`] — the WHATWG header list.
8//! - [`body`] — request/response body (`Empty` / `Bytes` / stream).
9//! - [`model`] — [`Request`] / [`Response`] + the `RedirectMode` /
10//! `Credentials` / `ResponseType` enums and `RemoteAddr`.
11//! - [`error`] — the typed [`FetchError`].
12//! - [`engine`] — the client pool and the one manual-redirect send loop.
13//! - [`net_guard`] — SSRF policy (allow-list, metadata/private blocking).
14//! - [`cookie`] — RFC 6265 parsing/matching for the context-bound path.
15//! - [`multipart`] — `multipart/form-data` serialization and parsing.
16//! - [`bridge`] — the two-way cookie/defaults bridge to a host-owned jar
17//! (a browser context, a session store).
18//! - [`cookie`] also carries the [`Cookie`] record that bridge speaks.
19
20pub mod body;
21pub mod bridge;
22pub mod cookie;
23pub mod engine;
24pub mod error;
25pub mod headers;
26pub mod model;
27pub mod multipart;
28pub mod net_guard;
29
30pub use body::{Body, ByteStream, channel_stream};
31pub use bridge::{BridgeFuture, ContextBridge, ContextDefaults};
32pub use cookie::{Cookie, SameSite};
33pub use error::FetchError;
34pub use headers::Headers;
35pub use model::{Credentials, RedirectMode, RemoteAddr, Request, Response, ResponseType};
36pub use multipart::{
37 MultipartField, MultipartValue, multipart_boundary, multipart_boundary_of, parse_multipart, serialize_multipart,
38};
39pub use net_guard::{GuardError, NetGuard, NetPolicy, check_url, preflight};
40/// The transport crate, for a host that needs its `Url` / `Method`.
41pub use reqwest;
42
43pub use engine::{ClientPool, send};