Struct webmachine_rust::context::WebmachineRequest  
source · 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>>,
}Expand description
Request that the state machine is executing against
Fields§
§request_path: StringPath of the request relative to the resource
base_path: StringResource base path
method: StringRequest method
headers: HashMap<String, Vec<HeaderValue>>Request headers
body: Option<Vec<u8>>Request body
query: HashMap<String, Vec<String>>Query parameters
Implementations§
source§impl WebmachineRequest
 
impl WebmachineRequest
sourcepub fn content_type(&self) -> String
 
pub fn content_type(&self) -> String
returns the content type of the request, based on the content type header. Defaults to ‘application/json’ if there is no header.
sourcepub fn is_put_or_post(&self) -> bool
 
pub fn is_put_or_post(&self) -> bool
If the request is a put or post
sourcepub fn is_get_or_head(&self) -> bool
 
pub fn is_get_or_head(&self) -> bool
If the request is a get or head request
sourcepub fn is_options(&self) -> bool
 
pub fn is_options(&self) -> bool
If the request is an options
sourcepub fn has_accept_header(&self) -> bool
 
pub fn has_accept_header(&self) -> bool
If an Accept header exists
sourcepub fn accept(&self) -> Vec<HeaderValue>
 
pub fn accept(&self) -> Vec<HeaderValue>
Returns the acceptable media types from the Accept header
sourcepub fn has_accept_language_header(&self) -> bool
 
pub fn has_accept_language_header(&self) -> bool
If an Accept-Language header exists
sourcepub fn accept_language(&self) -> Vec<HeaderValue>
 
pub fn accept_language(&self) -> Vec<HeaderValue>
Returns the acceptable languages from the Accept-Language header
sourcepub fn has_accept_charset_header(&self) -> bool
 
pub fn has_accept_charset_header(&self) -> bool
If an Accept-Charset header exists
sourcepub fn accept_charset(&self) -> Vec<HeaderValue>
 
pub fn accept_charset(&self) -> Vec<HeaderValue>
Returns the acceptable charsets from the Accept-Charset header
sourcepub fn has_accept_encoding_header(&self) -> bool
 
pub fn has_accept_encoding_header(&self) -> bool
If an Accept-Encoding header exists
sourcepub fn accept_encoding(&self) -> Vec<HeaderValue>
 
pub fn accept_encoding(&self) -> Vec<HeaderValue>
Returns the acceptable encodings from the Accept-Encoding header
sourcepub fn has_header(&self, header: &str) -> bool
 
pub fn has_header(&self, header: &str) -> bool
If the request has the provided header
sourcepub fn find_header(&self, header: &str) -> Vec<HeaderValue>
 
pub fn find_header(&self, header: &str) -> Vec<HeaderValue>
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.
sourcepub fn has_header_value(&self, header: &str, value: &str) -> bool
 
pub fn has_header_value(&self, header: &str, value: &str) -> bool
If the header has a matching value
Trait Implementations§
source§impl Clone for WebmachineRequest
 
impl Clone for WebmachineRequest
source§fn clone(&self) -> WebmachineRequest
 
fn clone(&self) -> WebmachineRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for WebmachineRequest
 
impl Debug for WebmachineRequest
source§impl Default for WebmachineRequest
 
impl Default for WebmachineRequest
source§fn default() -> WebmachineRequest
 
fn default() -> WebmachineRequest
Creates a default request (GET /)
source§impl PartialEq<WebmachineRequest> for WebmachineRequest
 
impl PartialEq<WebmachineRequest> for WebmachineRequest
source§fn eq(&self, other: &WebmachineRequest) -> bool
 
fn eq(&self, other: &WebmachineRequest) -> bool
self and other values to be equal, and is used
by ==.