Struct webmachine::context::Request
source · [−]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
sourceimpl Request
impl Request
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
impl StructuralPartialEq for Request
Auto Trait Implementations
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more