pub struct Request<'r> { /* private fields */ }Expand description
The request as gates and handlers read it: the parts web-net has checked (the host matched a site, the path is canonical) and the raw request underneath.
Implementations§
Source§impl<'r> Request<'r>
impl<'r> Request<'r>
Sourcepub fn path(&self) -> &'r str
pub fn path(&self) -> &'r str
The canonical path inside the site: the base path removed, percent
escapes in their one canonical form. / for the site root.
Sourcepub fn query(&self) -> Option<&'r str>
pub fn query(&self) -> Option<&'r str>
The query after ?, as received (validated by the parser, not
decoded).
Sourcepub fn host(&self) -> &'r str
pub fn host(&self) -> &'r str
The host the request named, as received (empty for an HTTP/1.0 request without one). It matched one of the site’s hosts, unless the site accepts any host.
Sourcepub fn header_str(&self, name: &str) -> Option<&'r str>
pub fn header_str(&self, name: &str) -> Option<&'r str>
The first value of a field, if it is UTF-8.
Sourcepub fn client(&self) -> &'r ClientInfo
pub fn client(&self) -> &'r ClientInfo
The client, as serve-net established it (the real address behind a trusted proxy).
Sourcepub fn scheme(&self) -> Scheme
pub fn scheme(&self) -> Scheme
https when the request came over TLS (or from a trusted proxy that
said so).
Sourcepub fn route(&self) -> Option<&'r str>
pub fn route(&self) -> Option<&'r str>
The pattern of the matched route (/users/:id), once routing ran.
Sourcepub fn raw(&self) -> &'r HttpRequest<'r>
pub fn raw(&self) -> &'r HttpRequest<'r>
The raw request: the target as received, every field, the body.