expression
Remove URL from an error before reporting
Reqwest errors may carry a URL, which could contain sensitive query values. Strip that field and prefer a bounded, structured public message. Removing the URL is not a guarantee that every nested cause is free of sensitive information. External crate example; constructs requests or synthetic responses in memory; no request is sent. Expected stdout (not executed): true Common mistake: Logging raw URLs or assuming every error source is automatically redacted.
Formal Syntax & Structure
rust syntaxrust
error.without_url()Working Example
Example Snippetrust
#[tokio::main(flavor = "current_thread")]async fn main() { let c = reqwest::Client::builder().no_proxy().build().unwrap(); let err = c.get("not a url").build().unwrap_err(); let clean = err.with_url("https://example.com/?key=dummy".parse().unwrap()).without_url(); println!("{}", clean.url().is_none());}