pub struct RequestBuilder { /* private fields */ }Expand description
Re-export cdk-http-client types HTTP request builder for complex requests
Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn header(
self,
key: impl AsRef<str>,
value: impl AsRef<str>,
) -> RequestBuilder
pub fn header( self, key: impl AsRef<str>, value: impl AsRef<str>, ) -> RequestBuilder
Add a header to the request
Sourcepub fn json<T>(self, body: &T) -> RequestBuilder
pub fn json<T>(self, body: &T) -> RequestBuilder
Set the request body as JSON
Sourcepub fn form<T>(self, body: &T) -> RequestBuilder
pub fn form<T>(self, body: &T) -> RequestBuilder
Set the request body as form data
Sourcepub async fn send(self) -> Result<RawResponse, HttpError>
pub async fn send(self) -> Result<RawResponse, HttpError>
Send the request and return a raw response
Sourcepub async fn send_json<R>(self) -> Result<R, HttpError>where
R: DeserializeOwned,
pub async fn send_json<R>(self) -> Result<R, HttpError>where
R: DeserializeOwned,
Send the request and deserialize the response as JSON
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RequestBuilder
impl !RefUnwindSafe for RequestBuilder
impl Send for RequestBuilder
impl Sync for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin for RequestBuilder
impl !UnwindSafe for RequestBuilder
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