pub struct Request {
pub method: Method,
pub url: String,
pub headers: Vec<(String, String)>,
pub body: Option<Vec<u8>>,
}Expand description
A fully-built request handed to a Transport.
Fields§
§method: MethodHTTP method.
url: StringAbsolute URL.
headers: Vec<(String, String)>Header name/value pairs.
body: Option<Vec<u8>>Serialized JSON body, if any.
Implementations§
Source§impl Request
impl Request
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a header (builder style).
Sourcepub fn body_json<T: Serialize>(self, value: &T) -> Result<Self>
pub fn body_json<T: Serialize>(self, value: &T) -> Result<Self>
Set a JSON body (builder style).
Sourcepub fn header_value(&self, name: &str) -> Option<&str>
pub fn header_value(&self, name: &str) -> Option<&str>
Look up a header value (case-insensitive).
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