expression

Reqwest: build without sending

Inspect a request before handing it to the HTTP transport. Build is synchronous; sending requires awaiting a future. A valid request does not prove that the destination exists. External crate example; constructs requests or synthetic responses in memory; no request is sent. Expected stdout (not executed): GET /books Common mistake: Confusing a successful build with a network response.

Formal Syntax & Structure

rust syntaxrust
client.get(url).build() -> Result<Request>

Working Example

Example Snippetrust
#[tokio::main(flavor = "current_thread")]async fn main() {    let c = reqwest::Client::builder().no_proxy().build().unwrap();    let r = c.get("https://example.com/books").build().unwrap();    println!("{} {}", r.method(), r.url().path());}
Rust Reference