Struct reqwest_middleware::RequestBuilder
source · pub struct RequestBuilder { /* private fields */ }Expand description
This is a wrapper around reqwest::RequestBuilder exposing the same API.
Implementations§
source§impl RequestBuilder
impl RequestBuilder
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere HeaderName: TryFrom<K>, <HeaderName as TryFrom<K>>::Error: Into<Error>, HeaderValue: TryFrom<V>, <HeaderValue as TryFrom<V>>::Error: Into<Error>,
pub fn headers(self, headers: HeaderMap) -> Self
pub fn basic_auth<U, P>(self, username: U, password: Option<P>) -> Selfwhere U: Display, P: Display,
pub fn bearer_auth<T>(self, token: T) -> Selfwhere T: Display,
pub fn body<T: Into<Body>>(self, body: T) -> Self
pub fn timeout(self, timeout: Duration) -> Self
pub fn multipart(self, multipart: Form) -> Self
pub fn query<T: Serialize + ?Sized>(self, query: &T) -> Self
pub fn form<T: Serialize + ?Sized>(self, form: &T) -> Self
pub fn json<T: Serialize + ?Sized>(self, json: &T) -> Self
pub fn build(self) -> Result<Request>
sourcepub fn with_extension<T: Send + Sync + 'static>(self, extension: T) -> Self
pub fn with_extension<T: Send + Sync + 'static>(self, extension: T) -> Self
Inserts the extension into this request builder
sourcepub fn extensions(&mut self) -> &mut Extensions
pub fn extensions(&mut self) -> &mut Extensions
Returns a mutable reference to the internal set of extensions for this request
pub async fn send(self) -> Result<Response>
sourcepub fn try_clone(&self) -> Option<Self>
pub fn try_clone(&self) -> Option<Self>
Attempt to clone the RequestBuilder.
None is returned if the RequestBuilder can not be cloned,
i.e. if the request body is a stream.
Extensions
Note that extensions are not preserved through cloning.