pub struct Request {Show 14 fields
pub method: Method,
pub uri: Uri,
pub headers: HeaderMap,
pub body: Body,
pub params: HashMap<String, String>,
pub query: HashMap<String, String>,
pub json_body: Option<Value>,
pub form_data_cache: Option<HashMap<String, String>>,
pub request_id: String,
pub user_id: Option<String>,
pub user_roles: Vec<String>,
pub session: Option<SessionHandle>,
pub extensions: Extensions,
pub remote_addr: Option<SocketAddr>,
}Fields§
§method: Method§uri: Uri§headers: HeaderMap§body: Body§params: HashMap<String, String>§query: HashMap<String, String>§json_body: Option<Value>§form_data_cache: Option<HashMap<String, String>>§request_id: String§user_id: Option<String>§user_roles: Vec<String>§session: Option<SessionHandle>§extensions: Extensions§remote_addr: Option<SocketAddr>Implementations§
Source§impl Request
impl Request
pub async fn from_hyper( req: HyperRequest<Body>, ) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn from_hyper_with_addr( req: HyperRequest<Body>, remote_addr: Option<SocketAddr>, ) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn json(&mut self) -> Result<Value, Box<dyn Error + Send + Sync>>
pub async fn form_data( &mut self, ) -> Result<HashMap<String, String>, Box<dyn Error + Send + Sync>>
Sourcepub fn request_id(&self) -> &str
pub fn request_id(&self) -> &str
Return the correlation ID assigned to this request.
Sourcepub const fn request_id_header() -> &'static str
pub const fn request_id_header() -> &'static str
Header name used for request correlation.
pub fn param(&self, key: &str) -> Option<&String>
pub fn query_param(&self, key: &str) -> Option<&String>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Request
impl !RefUnwindSafe for Request
impl !UnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more