pub struct UniversalRequest {
pub method: Cow<'static, str>,
pub path: String,
pub headers: HashMap<Cow<'static, str>, Cow<'static, str>>,
pub query_params: HashMap<String, String>,
pub body: Option<Vec<u8>>,
}
Expand description
Universal request type for framework integration
Fields§
§method: Cow<'static, str>
§path: String
§headers: HashMap<Cow<'static, str>, Cow<'static, str>>
§query_params: HashMap<String, String>
§body: Option<Vec<u8>>
Implementations§
Source§impl UniversalRequest
impl UniversalRequest
Sourcepub fn new(
method: impl Into<Cow<'static, str>>,
path: impl Into<String>,
) -> Self
pub fn new( method: impl Into<Cow<'static, str>>, path: impl Into<String>, ) -> Self
Create a new universal request
Sourcepub fn with_header(
self,
name: impl Into<Cow<'static, str>>,
value: impl Into<Cow<'static, str>>,
) -> Self
pub fn with_header( self, name: impl Into<Cow<'static, str>>, value: impl Into<Cow<'static, str>>, ) -> Self
Add a header
Sourcepub fn with_query(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_query( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Add a query parameter
Sourcepub fn accepts(&self, content_type: &str) -> bool
pub fn accepts(&self, content_type: &str) -> bool
Check if request accepts a specific content type
Sourcepub fn preferred_streaming_format(&self) -> StreamingFormat
pub fn preferred_streaming_format(&self) -> StreamingFormat
Get preferred streaming format from headers
Trait Implementations§
Source§impl Clone for UniversalRequest
impl Clone for UniversalRequest
Source§fn clone(&self) -> UniversalRequest
fn clone(&self) -> UniversalRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for UniversalRequest
impl RefUnwindSafe for UniversalRequest
impl Send for UniversalRequest
impl Sync for UniversalRequest
impl Unpin for UniversalRequest
impl UnwindSafe for UniversalRequest
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
Mutably borrows from an owned value. Read more