pub struct Request {
pub method: String,
pub path: String,
pub headers: HashMap<String, String>,
pub query_params: HashMap<String, String>,
pub path_params: HashMap<String, String>,
pub body: Option<String>,
pub context: Context,
/* private fields */
}Expand description
HTTP Request representation
Fields§
§method: String§path: String§headers: HashMap<String, String>§query_params: HashMap<String, String>§path_params: HashMap<String, String>§body: Option<String>§context: ContextImplementations§
Source§impl Request
impl Request
Sourcepub fn from_lambda_event(event: Value) -> Self
pub fn from_lambda_event(event: Value) -> Self
Create a new Request from Lambda event
Sourcepub fn path_param(&self, name: &str) -> Option<&String>
pub fn path_param(&self, name: &str) -> Option<&String>
Get path parameter
Sourcepub fn json<T: for<'de> Deserialize<'de>>(&self) -> Result<T, Error>
pub fn json<T: for<'de> Deserialize<'de>>(&self) -> Result<T, Error>
Parse JSON body
Sourcepub fn is_preflight(&self) -> bool
pub fn is_preflight(&self) -> bool
Check if request is CORS preflight
Sourcepub fn set_context(&mut self, context: Context)
pub fn set_context(&mut self, context: Context)
Set context (used internally by middleware)
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 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