pub struct Request {
    pub method: Option<HttpMethod>,
    pub uri: String,
    pub user_agent: String,
    pub user_addr: SocketAddr,
    pub get_request: HashMap<String, String>,
    pub post_request: HashMap<String, PostRequest>,
    pub raw_request: Vec<String>,
    pub secure: bool,
}
Expand description

Request

Handles requests from users, and returns it in a friendly, safe way.

Can be used to gather POST and GET info, user-agent information and more

If you have custom headers, and want to access them, use raw_request to access the raw unmodified request

Fields

method: Option<HttpMethod>

Method stores the method used to make the request

uri: String

URI contains the URI of the request

user_agent: String

User Agent stores the user agent of the user

user_addr: SocketAddr

User Addr stores the users IP address

get_request: HashMap<String, String>

Get Request stores the data of the get request.

It is a HashMap<String, String>

The key of the hashmap is equal to the name of the form field name.

post_request: HashMap<String, PostRequest>

Post Request stores the data of the post request.

It is a HashMap<String, PostRequest>

The key of the hashmap is equal to the name of the form field name.

raw_request: Vec<String>

Raw Request stores the raw request without any modifications.

secure: bool

Did the request come from a secure connection?

Implementations

New

Create a new request struct.

Takes an input string (Which should be the request).

It will then construct itself and return, ready to use.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.