Struct longport_httpcli::RequestBuilder
source · pub struct RequestBuilder<T, Q, R> { /* private fields */ }Expand description
A request builder
Implementations§
source§impl<T, Q, R> RequestBuilder<T, Q, R>
impl<T, Q, R> RequestBuilder<T, Q, R>
sourcepub fn body<T2>(self, body: T2) -> RequestBuilder<T2, Q, R>where
T2: ToPayload,
pub fn body<T2>(self, body: T2) -> RequestBuilder<T2, Q, R>where T2: ToPayload,
Set the request body
sourcepub fn header<K, V>(self, key: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere K: TryInto<HeaderName>, V: TryInto<HeaderValue>,
Set the header
sourcepub fn query_params<Q2>(self, params: Q2) -> RequestBuilder<T, Q2, R>where
Q2: Serialize + Send + Sync,
pub fn query_params<Q2>(self, params: Q2) -> RequestBuilder<T, Q2, R>where Q2: Serialize + Send + Sync,
Set the query string
sourcepub fn response<R2>(self) -> RequestBuilder<T, Q, R2>where
R2: FromPayload,
pub fn response<R2>(self) -> RequestBuilder<T, Q, R2>where R2: FromPayload,
Set the response body type
source§impl<T, Q, R> RequestBuilder<T, Q, R>where
T: ToPayload,
Q: Serialize + Send,
R: FromPayload,
impl<T, Q, R> RequestBuilder<T, Q, R>where T: ToPayload, Q: Serialize + Send, R: FromPayload,
sourcepub async fn send(self) -> HttpClientResult<R>
pub async fn send(self) -> HttpClientResult<R>
Send request and get the response
Auto Trait Implementations§
impl<T, Q, R> !RefUnwindSafe for RequestBuilder<T, Q, R>
impl<T, Q, R> Send for RequestBuilder<T, Q, R>where Q: Send, R: Send, T: Send,
impl<T, Q, R> Sync for RequestBuilder<T, Q, R>where Q: Sync, R: Sync, T: Sync,
impl<T, Q, R> Unpin for RequestBuilder<T, Q, R>where Q: Unpin, R: Unpin, T: Unpin,
impl<T, Q, R> !UnwindSafe for RequestBuilder<T, Q, R>
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