pub struct Request {
pub method: Method,
pub url: String,
pub headers: HeaderMap,
pub body: Option<RequestBody>,
pub compression: RequestCompression,
pub timeout: Option<Duration>,
}Fields§
§method: Method§url: String§headers: HeaderMap§body: Option<RequestBody>§compression: RequestCompression§timeout: Option<Duration>Implementations§
Source§impl Request
impl Request
pub fn new(method: Method, url: String) -> Self
pub fn with_json<T: Serialize>(self, body: &T) -> Self
pub fn with_raw_body(self, body: impl Into<Bytes>) -> Self
pub fn with_compression(self, compression: RequestCompression) -> Self
Sourcepub fn into_prepared(self) -> Result<Self, String>
pub fn into_prepared(self) -> Result<Self, String>
Prepares the body once and stores the exact bytes that will be sent.
Cloning the returned request shares the body bytes, so retry attempts do not repeat JSON serialization or compression. Request-signing auth also sees the same final headers and bytes that the transport will send.
Sourcepub fn prepare_body_for_send(&self) -> Result<PreparedRequestBody, String>
pub fn prepare_body_for_send(&self) -> Result<PreparedRequestBody, String>
Convert the request body into the exact bytes that will be sent.
Auth schemes such as AWS SigV4 need to sign the final body bytes, including compression and content headers. Calling this method does not mutate the request.
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