pub trait ReqwestExt {
// Required methods
fn graphql(self, req: impl IntoRequestParameters) -> Result<Self, Error>
where Self: Sized;
fn send_graphql<'async_trait, ResponseData>(
self,
req: impl 'async_trait + IntoRequestParameters + Send,
) -> Pin<Box<dyn Future<Output = Result<ResponseResult<ResponseData>, RequestError>> + Send + 'async_trait>>
where ResponseData: DeserializeOwned + 'async_trait,
Self: 'async_trait;
}
Available on crate feature
reqwest
only.Expand description
An extension trait for reqwest::RequestBuilder.
Required Methods§
Sourcefn graphql(self, req: impl IntoRequestParameters) -> Result<Self, Error>where
Self: Sized,
fn graphql(self, req: impl IntoRequestParameters) -> Result<Self, Error>where
Self: Sized,
Sets the Content-Type
and Accept
headers to the GraphQL-over-HTTP media types and
serializes the GraphQL request.
If the GraphQL request cannot be serialized, an error is returned.
Sourcefn send_graphql<'async_trait, ResponseData>(
self,
req: impl 'async_trait + IntoRequestParameters + Send,
) -> Pin<Box<dyn Future<Output = Result<ResponseResult<ResponseData>, RequestError>> + Send + 'async_trait>>where
ResponseData: DeserializeOwned + 'async_trait,
Self: 'async_trait,
fn send_graphql<'async_trait, ResponseData>(
self,
req: impl 'async_trait + IntoRequestParameters + Send,
) -> Pin<Box<dyn Future<Output = Result<ResponseResult<ResponseData>, RequestError>> + Send + 'async_trait>>where
ResponseData: DeserializeOwned + 'async_trait,
Self: 'async_trait,
Runs a GraphQL query with the parameters in RequestBuilder, deserializes the body and returns the result.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.