pub struct Request { /* private fields */ }
Expand description
A Request representation for handling incoming and creating outbound HTTP requests.
Implementations§
source§impl Request
impl Request
sourcepub fn new(uri: &str, method: Method) -> Result<Self>
pub fn new(uri: &str, method: Method) -> Result<Self>
Construct a new Request
with an HTTP Method.
sourcepub fn new_with_init(uri: &str, init: &RequestInit) -> Result<Self>
pub fn new_with_init(uri: &str, init: &RequestInit) -> Result<Self>
Construct a new Request
with a RequestInit
configuration.
sourcepub async fn json<B: DeserializeOwned>(&mut self) -> Result<B>
pub async fn json<B: DeserializeOwned>(&mut self) -> Result<B>
Access this request’s body encoded as JSON.
sourcepub async fn form_data(&mut self) -> Result<FormData>
pub async fn form_data(&mut self) -> Result<FormData>
Access this request’s body as a form-encoded payload and pull out fields and files.
sourcepub fn stream(&mut self) -> Result<ByteStream>
pub fn stream(&mut self) -> Result<ByteStream>
Access this request’s body as a Stream
of bytes.
sourcepub fn headers_mut(&mut self) -> Result<&mut Headers>
pub fn headers_mut(&mut self) -> Result<&mut Headers>
Get a mutable reference to this request’s Headers
.
Note: they can only be modified if the request was created from scratch or cloned.
sourcepub fn path_mut(&mut self) -> Result<&mut String>
pub fn path_mut(&mut self) -> Result<&mut String>
Get a mutable reference to this request’s path. Note: they can only be modified if the request was created from scratch or cloned.
pub fn clone(&self) -> Result<Self>
pub fn clone_mut(&self) -> Result<Self>
pub fn inner(&self) -> &Request
Trait Implementations§
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§
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