pub struct Request { /* private fields */ }Expand description
A pipeline request.
A pipeline request is composed by a destination (uri), a method, a collection of headers and a body. Policies are expected to enrich the request by mutating it.
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(url: Url, method: Method) -> Request
pub fn new(url: Url, method: Method) -> Request
Create a new request with an empty body and no headers
Sourcepub fn path_and_query(&self) -> String
pub fn path_and_query(&self) -> String
Gets the request URL path and query string.
Sourcepub fn set_method(&mut self, method: Method)
pub fn set_method(&mut self, method: Method)
Sets the request HTTP method.
Sourcepub fn insert_headers<T>(
&mut self,
headers: &T,
) -> Result<(), <T as AsHeaders>::Error>where
T: AsHeaders,
pub fn insert_headers<T>(
&mut self,
headers: &T,
) -> Result<(), <T as AsHeaders>::Error>where
T: AsHeaders,
Inserts zero or more headers from a type that implements AsHeaders.
Sourcepub fn headers_mut(&mut self) -> &mut Headers
pub fn headers_mut(&mut self) -> &mut Headers
Gets a mutable request Headers.
Sourcepub fn set_json<T>(&mut self, data: &T) -> Result<(), Error>
Available on crate feature json only.
pub fn set_json<T>(&mut self, data: &T) -> Result<(), Error>
json only.Sets request body JSON.
Sourcepub fn insert_header<K, V>(&mut self, key: K, value: V)
pub fn insert_header<K, V>(&mut self, key: K, value: V)
Inserts a header from the key and value.
Sourcepub fn add_optional_header<T>(&mut self, item: &Option<T>)where
T: Header,
pub fn add_optional_header<T>(&mut self, item: &Option<T>)where
T: Header,
Inserts a Header if item is Some.
Sourcepub fn add_mandatory_header<T>(&mut self, item: &T)where
T: Header,
pub fn add_mandatory_header<T>(&mut self, item: &T)where
T: Header,
Inserts a Header.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Request
impl !RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl !UnwindSafe for Request
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