pub struct Request {
pub headers: SmallVec<[((usize, usize), (usize, usize)); 8]>,
pub params: Option<HashMap<String, String>>,
/* private fields */
}
Expand description
The request object is the default request object provied by Thruster. If a different server is used, such as Hyper, then you’ll need to reference that server’s “request” documentation instead.
Fields§
§headers: SmallVec<[((usize, usize), (usize, usize)); 8]>
§params: Option<HashMap<String, String>>
Implementations§
source§impl Request
impl Request
sourcepub fn headers(&self) -> HashMap<String, Vec<String>>
pub fn headers(&self) -> HashMap<String, Vec<String>>
Get an HashMap of the provided headers. The HashMap is lazily computed, so avoid this method unless you need to access headers.
sourcepub fn body_as<'a, T>(&self, body: &'a str) -> Result<T>where
T: Deserialize<'a>,
pub fn body_as<'a, T>(&self, body: &'a str) -> Result<T>where T: Deserialize<'a>,
Automatically apply a serde deserialization to the body
sourcepub fn body_json<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn body_json<T>(&self) -> Result<T>where T: DeserializeOwned,
Reading body as json with given Deserialize struct
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin 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