pub struct Request(_);
Available on crate features
net
and http
only.Expand description
The Request
sent to the server
Implementations§
source§impl Request
impl Request
sourcepub fn body_used(&self) -> bool
pub fn body_used(&self) -> bool
Has the request body been consumed?
If true, then any future attempts to consume the body will error.
sourcepub fn body(&self) -> Option<ReadableStream>
pub fn body(&self) -> Option<ReadableStream>
Gets the body.
sourcepub async fn form_data(&self) -> impl Future<Output = Result<FormData, Error>>
pub async fn form_data(&self) -> impl Future<Output = Result<FormData, Error>>
Reads the request to completion, returning it as FormData
.
sourcepub async fn json<T>(&self) -> impl Future<Output = Result<T, Error>>where
T: DeserializeOwned,
Available on crate feature json
only.
pub async fn json<T>(&self) -> impl Future<Output = Result<T, Error>>where T: DeserializeOwned,
json
only.Reads the request to completion, parsing it as JSON.
sourcepub async fn text(&self) -> impl Future<Output = Result<String, Error>>
pub async fn text(&self) -> impl Future<Output = Result<String, Error>>
Reads the reqeust as a String.
sourcepub async fn binary(
&self
) -> impl Future<Output = Result<Vec<u8, Global>, Error>>
pub async fn binary( &self ) -> impl Future<Output = Result<Vec<u8, Global>, Error>>
Gets the binary request
This works by obtaining the response as an ArrayBuffer
, creating a Uint8Array
from it
and then converting it to Vec<u8>
sourcepub fn mode(&self) -> RequestMode
pub fn mode(&self) -> RequestMode
Return the read only mode for the 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