logo
pub struct Request {
    pub request_path: String,
    pub base_path: String,
    pub method: String,
    pub headers: HashMap<String, Vec<HeaderValue>>,
    pub body: Option<Vec<u8>>,
    pub query: HashMap<String, Vec<String>>,
}
Expand description

Request that the state machine is executing against

Fields

request_path: String

Path of the request relative to the resource

base_path: String

Resource base path

method: String

Request method

headers: HashMap<String, Vec<HeaderValue>>

Request headers

body: Option<Vec<u8>>

Request body

query: HashMap<String, Vec<String>>

Query parameters

Implementations

returns the content type of the request, based on the content type header. Defaults to ‘application/json’ if there is no header.

source

pub fn is_put_or_post(&self) -> bool

If the request is a put or post

If the request is a get or head request

If the request is a get

If the request is an options

If the request is a put

source

pub fn is_post(&self) -> bool

If the request is a post

If the request is a delete

If an Accept header exists

Returns the acceptable media types from the Accept header

If an Accept-Language header exists

Returns the acceptable languages from the Accept-Language header

If an Accept-Charset header exists

Returns the acceptable charsets from the Accept-Charset header

If an Accept-Encoding header exists

Returns the acceptable encodings from the Accept-Encoding header

If the request has the provided header

Returns the list of values for the provided request header. If the header is not present, or has no value, and empty vector is returned.

If the header has a matching value

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates a default request (GET /)

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more