pub struct AsyncRequestBuilder<'a> { /* private fields */ }Expand description
Builder for an async HTTP request.
Implementations§
Source§impl<'a> AsyncRequestBuilder<'a>
impl<'a> AsyncRequestBuilder<'a>
Sourcepub fn header(self, name: &str, value: &str) -> AsyncRequestBuilder<'a>
pub fn header(self, name: &str, value: &str) -> AsyncRequestBuilder<'a>
Add a request header.
Sourcepub fn body(self, bytes: Vec<u8>) -> AsyncRequestBuilder<'a>
pub fn body(self, bytes: Vec<u8>) -> AsyncRequestBuilder<'a>
Set a raw byte body.
Sourcepub fn body_text(self, s: &str) -> AsyncRequestBuilder<'a>
pub fn body_text(self, s: &str) -> AsyncRequestBuilder<'a>
Set a plain-text body (sets Content-Type: text/plain).
Sourcepub fn body_json(self, s: &str) -> AsyncRequestBuilder<'a>
pub fn body_json(self, s: &str) -> AsyncRequestBuilder<'a>
Set a JSON body (sets Content-Type: application/json).
Sourcepub fn form(self, pairs: &[(&str, &str)]) -> AsyncRequestBuilder<'a>
pub fn form(self, pairs: &[(&str, &str)]) -> AsyncRequestBuilder<'a>
Set an application/x-www-form-urlencoded body from key/value
pairs (sets Content-Type: application/x-www-form-urlencoded).
Sourcepub fn timeout_ms(self, ms: u64) -> AsyncRequestBuilder<'a>
pub fn timeout_ms(self, ms: u64) -> AsyncRequestBuilder<'a>
Override the timeout for this request.
Sourcepub async fn send(self) -> Result<Response, HttpClientError>
pub async fn send(self) -> Result<Response, HttpClientError>
Send the request asynchronously.
Auto Trait Implementations§
impl<'a> Freeze for AsyncRequestBuilder<'a>
impl<'a> RefUnwindSafe for AsyncRequestBuilder<'a>
impl<'a> Send for AsyncRequestBuilder<'a>
impl<'a> Sync for AsyncRequestBuilder<'a>
impl<'a> Unpin for AsyncRequestBuilder<'a>
impl<'a> UnsafeUnpin for AsyncRequestBuilder<'a>
impl<'a> UnwindSafe for AsyncRequestBuilder<'a>
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