pub struct Request<'a> { /* private fields */ }

Implementations

Get the value of a header pair by specifying the key For example, Content-length: 123 get_header(“Content-length”), the key is not case senstive

Get the value of a parameter in the requested url

For example

/path?id=1

  • get_param("id") returns 1, the key is case senstive

Get the HashMap of the parameters in the requested url

For example

/path?id=1&flag=true

  • get_params() returns {id:1, flag:true }

Get the complete http headers

  • {"Content-length":"1", "key":"value",...}

Get the version of http request

Query the value of www-form-urlencoded or the text part of the multipart-form

  • The key is not case senstive
For example

Assume the form has the value id=1, then get_query(“id”) returns Some(“1”)

This method is used to acquire the file in the multipart-form data

For example,
<form>
   <input type="file" name="file1" />
</form>
  • get_file("file1") return the file’s meta data

Return a HashMap that comprises all pairs in the www-form-urlencoded or the text part of the multipart-form

  • It is safety called even though the request is GET, which returns None

Returns an array comprises of all files in the multipart-form data

Returns the body of a request

  • it is used for getting the posted JSON or other plain text body

Determin whether the request has a body

Return the raw instance of TcpStream

  • This method should be carefully used, It is better to only get some meta information of a connection, such as a peer IP

Return the requested http method

Return the complete requested url

Return the part of url exclude the parameters(if any)

It is used to store user data

  • share data between middlwares and routers(if any)

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

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.