pub struct Request {
    pub headers: SmallVec<[((usize, usize), (usize, usize)); 8]>,
    pub params: Option<HashMap<String, String>>,
    /* private fields */
}
Expand description

The request object is the default request object provied by Thruster. If a different server is used, such as Hyper, then you’ll need to reference that server’s “request” documentation instead.

Fields

headers: SmallVec<[((usize, usize), (usize, usize)); 8]>params: Option<HashMap<String, String>>

Implementations

Create a new, blank, request.

Get the raw pointer to the byte array of the request

Get the body as a utf8 encoded string

Get the method as a string

Get the path as a string (“/some/path”)

Get the HTTP version

Get an HashMap of the provided headers. The HashMap is lazily computed, so avoid this method unless you need to access headers.

Automatically apply a serde deserialization to the body

Reading body as json with given Deserialize struct

Fetch the params from the route, e.g. The route “/some/:key” when applied to an incoming request for “/some/value” will populate params with { key: "value" }

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. 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

Returns the argument unchanged.

Calls U::from(self).

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

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.