[][src]Struct webmachine_rust::context::WebmachineRequest

pub struct WebmachineRequest {
    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>>,
}

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

impl WebmachineRequest[src]

pub fn content_type(&self) -> String[src]

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

pub fn is_put_or_post(&self) -> bool[src]

If the request is a put or post

pub fn is_get_or_head(&self) -> bool[src]

If the request is a get or head request

pub fn is_get(&self) -> bool[src]

If the request is a get

pub fn is_options(&self) -> bool[src]

If the request is an options

pub fn is_put(&self) -> bool[src]

If the request is a put

pub fn is_post(&self) -> bool[src]

If the request is a post

pub fn is_delete(&self) -> bool[src]

If the request is a delete

pub fn has_accept_header(&self) -> bool[src]

If an Accept header exists

pub fn accept(&self) -> Vec<HeaderValue>[src]

Returns the acceptable media types from the Accept header

pub fn has_accept_language_header(&self) -> bool[src]

If an Accept-Language header exists

pub fn accept_language(&self) -> Vec<HeaderValue>[src]

Returns the acceptable languages from the Accept-Language header

pub fn has_accept_charset_header(&self) -> bool[src]

If an Accept-Charset header exists

pub fn accept_charset(&self) -> Vec<HeaderValue>[src]

Returns the acceptable charsets from the Accept-Charset header

pub fn has_accept_encoding_header(&self) -> bool[src]

If an Accept-Encoding header exists

pub fn accept_encoding(&self) -> Vec<HeaderValue>[src]

Returns the acceptable encodings from the Accept-Encoding header

pub fn has_header(&self, header: &str) -> bool[src]

If the request has the provided header

pub fn find_header(&self, header: &str) -> Vec<HeaderValue>[src]

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.

pub fn has_header_value(&self, header: &str, value: &str) -> bool[src]

If the header has a matching value

Trait Implementations

impl Clone for WebmachineRequest[src]

impl Debug for WebmachineRequest[src]

impl Default for WebmachineRequest[src]

pub fn default() -> WebmachineRequest[src]

Creates a default request (GET /)

impl PartialEq<WebmachineRequest> for WebmachineRequest[src]

impl StructuralPartialEq for WebmachineRequest[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.