Struct pencil::wrappers::Request
[−]
[src]
pub struct Request<'r, 'a, 'b> {
pub app: &'r Pencil,
pub request: Request<'a, 'b>,
pub url_rule: Option<Rule>,
pub view_args: ViewArgs,
pub routing_error: Option<HTTPError>,
pub extensions_data: TypeMap,
// some fields omitted
}Request type.
Fields
app | |
request | The original hyper request object. |
url_rule | The URL rule that matched the request. This is
going to be |
view_args | A dict of view arguments that matched the request. |
routing_error | If matching the URL failed, this will be the error. |
extensions_data | Storage for data of extensions. |
Methods
impl<'r, 'a, 'b> Request<'r, 'a, 'b>
fn new(app: &'r Pencil, request: Request<'a, 'b>) -> Request<'r, 'a, 'b>
Create a Request.
fn match_request(&mut self)
Match the request, set the url_rule and view_args field.
fn endpoint(&self) -> Option<String>
The endpoint that matched the request.
fn module_name(&self) -> Option<String>
The current module name.
fn args(&mut self) -> &MultiDict<String>
The parsed URL parameters.
fn get_json(&mut self) -> &Option<Json>
Parses the incoming JSON request data.
fn form(&mut self) -> &MultiDict<String>
The form parameters.
fn files(&mut self) -> &MultiDict<UploadedFile>
All uploaded files.
fn headers(&self) -> &Headers
The headers.
fn path(&self) -> Option<String>
Requested path.
fn full_path(&self) -> Option<String>
Requested path including the query string.
fn host(&self) -> Option<String>
The host including the port if available.
fn query_string(&self) -> Option<String>
The query string.
fn cookies(&self) -> Option<&Cookie>
The retrieved cookies.
fn method(&self) -> Method
The request method.
fn remote_addr(&self) -> SocketAddr
The remote address of the client.
fn scheme(&self) -> String
URL scheme (http or https)
fn host_url(&self) -> Option<String>
Just the host with scheme.
fn url(&self) -> Option<String>
The current url.
fn base_url(&self) -> Option<String>
The current url without the query string.
fn is_secure(&self) -> bool
Whether the request is secure (https).