pub struct Request(/* private fields */);
Available on crate feature
http
only.Expand description
The Request
sent to the server
Implementations§
source§impl Request
impl Request
sourcepub fn get(url: &str) -> RequestBuilder
pub fn get(url: &str) -> RequestBuilder
Creates a new GET
Request
with url.
sourcepub fn post(url: &str) -> RequestBuilder
pub fn post(url: &str) -> RequestBuilder
Creates a new POST
Request
with url.
sourcepub fn put(url: &str) -> RequestBuilder
pub fn put(url: &str) -> RequestBuilder
Creates a new PUT
Request
with url.
sourcepub fn delete(url: &str) -> RequestBuilder
pub fn delete(url: &str) -> RequestBuilder
Creates a new DELETE
Request
with url.
sourcepub fn patch(url: &str) -> RequestBuilder
pub fn patch(url: &str) -> RequestBuilder
Creates a new PATCH
Request
with url.
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) -> Result<FormData, Error>
pub async fn form_data(&self) -> Result<FormData, Error>
Reads the request to completion, returning it as FormData
.
sourcepub async fn json<T: DeserializeOwned>(&self) -> Result<T, Error>
Available on crate feature json
only.
pub async fn json<T: DeserializeOwned>(&self) -> Result<T, Error>
json
only.Reads the request to completion, parsing it as JSON.
sourcepub async fn binary(&self) -> Result<Vec<u8>, Error>
pub async fn binary(&self) -> Result<Vec<u8>, 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 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