pub struct Request {
pub method: Method,
pub url: String,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
pub timeout: Option<Duration>,
pub retry: Option<RetryPolicy>,
pub retry_unsafe_statuses: bool,
}Fields§
§method: Method§url: String§headers: Vec<(String, String)>§body: Vec<u8>§timeout: Option<Duration>§retry: Option<RetryPolicy>§retry_unsafe_statuses: boolAllow retrying a POST/PATCH after HTTP-status failures (default true for status codes; transport errors on non-idempotent methods only retry in the connect phase regardless).
Implementations§
Source§impl Request
impl Request
pub fn new(method: Method, url: impl Into<String>) -> Self
pub fn get(url: impl Into<String>) -> Self
pub fn post(url: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn bearer(self, token: &str) -> Self
pub fn body(self, body: impl Into<Vec<u8>>) -> Self
pub fn json<T: Serialize>(self, value: &T) -> Result<Self, HttpError>
pub fn timeout(self, d: Duration) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
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