client: Add a dummy http client

This commit is contained in:
Jonas Platte 2021-04-28 02:07:43 +02:00
parent 16f3e4911b
commit 0fa686ac1d
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -90,3 +90,27 @@ pub trait HttpClientExt: HttpClient {
#[async_trait] #[async_trait]
impl<T: HttpClient> HttpClientExt for T {} impl<T: HttpClient> HttpClientExt for T {}
#[doc(hidden)]
#[derive(Debug)]
pub struct Dummy;
#[async_trait]
impl HttpClient for Dummy {
type RequestBody = Vec<u8>;
type ResponseBody = Vec<u8>;
type Error = ();
async fn send_http_request(
&self,
_req: http::Request<Self::RequestBody>,
) -> Result<http::Response<Self::ResponseBody>, Self::Error> {
unimplemented!("this client only exists to allow doctests to compile")
}
}
impl DefaultConstructibleHttpClient for Dummy {
fn default() -> Self {
Dummy
}
}