pub struct HttpRequest {
pub method: String,
pub url: String,
pub headers: Vec<(String, String)>,
pub body: Option<Vec<u8>>,
pub make_body: Option<Box<dyn Fn() -> Result<Box<dyn Read + Send>> + Send + Sync>>,
pub follow_redirects: bool,
pub replayable: bool,
pub timeout: Option<Duration>,
}Expand description
A library-agnostic HTTP request.
Fields§
§method: String§url: String§headers: Vec<(String, String)>Header name/value pairs to set on the request.
body: Option<Vec<u8>>A fully materialized, replayable body (used for JSON requests).
make_body: Option<Box<dyn Fn() -> Result<Box<dyn Read + Send>> + Send + Sync>>A factory that produces a fresh body reader for each send attempt (used
for streaming uploads so a retry re-opens the file). Takes precedence
over body.
follow_redirects: boolWhether redirects may be followed. Only the self-contained, no-secret
download path opts in; every secret-bearing request keeps this false.
replayable: boolWhether the body can be re-sent. false for one-shot reader bodies —
such a request is never retried.
timeout: Option<Duration>The total request timeout, or None for no total cap (downloads /
uploads, which may legitimately run long).
Auto Trait Implementations§
impl !RefUnwindSafe for HttpRequest
impl !UnwindSafe for HttpRequest
impl Freeze for HttpRequest
impl Send for HttpRequest
impl Sync for HttpRequest
impl Unpin for HttpRequest
impl UnsafeUnpin for HttpRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more