pub struct WebmachineRequest {
pub request_path: String,
pub base_path: String,
pub path_vars: HashMap<String, String>,
pub method: String,
pub headers: HashMap<String, Vec<HeaderValue>>,
pub body: Option<Bytes>,
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
path_vars: HashMap<String, String>
Path parts mapped to any variables (i.e. parts like /{id} will have id mapped)
method: String
Request method
headers: HashMap<String, Vec<HeaderValue>>
Request headers
body: Option<Bytes>
Request body
query: HashMap<String, Vec<String>>
Query parameters
Implementations§
Source§impl WebmachineRequest
impl WebmachineRequest
Sourcepub fn content_type(&self) -> HeaderValue
pub fn content_type(&self) -> HeaderValue
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 for WebmachineRequest
impl PartialEq for WebmachineRequest
impl StructuralPartialEq for WebmachineRequest
Auto Trait Implementations§
impl !Freeze for WebmachineRequest
impl RefUnwindSafe for WebmachineRequest
impl Send for WebmachineRequest
impl Sync for WebmachineRequest
impl Unpin for WebmachineRequest
impl UnwindSafe for WebmachineRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more