From fc708c325db84f049e24ec9c3b323b48fb4555a7 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 31 May 2023 09:53:43 +0200 Subject: [PATCH] Add blanket HttpClient impl for hyper::Client --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 53ed652..59e1e89 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ use std::fmt; use std::sync::Arc; use base64::prelude::{Engine, BASE64_URL_SAFE_NO_PAD}; +use hyper::client::connect::Connect; #[cfg(feature = "hyper-rustls")] use hyper::client::HttpConnector; use hyper::client::ResponseFuture; @@ -625,5 +626,14 @@ pub trait HttpClient { fn request(&self, req: Request) -> ResponseFuture; } +impl HttpClient for hyper::Client +where + C: Connect + Clone + Send + Sync + 'static, +{ + fn request(&self, req: Request) -> ResponseFuture { + >::request(self, req) + } +} + const JOSE_JSON: &str = "application/jose+json"; const REPLAY_NONCE: &str = "Replay-Nonce";