Add blanket HttpClient impl for hyper::Client

This commit is contained in:
Dirkjan Ochtman 2023-05-31 09:53:43 +02:00
parent 1aa770c2de
commit fc708c325d
1 changed files with 10 additions and 0 deletions

View File

@ -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<Body>) -> ResponseFuture;
}
impl<C> HttpClient for hyper::Client<C>
where
C: Connect + Clone + Send + Sync + 'static,
{
fn request(&self, req: Request<Body>) -> ResponseFuture {
<hyper::Client<C>>::request(self, req)
}
}
const JOSE_JSON: &str = "application/jose+json";
const REPLAY_NONCE: &str = "Replay-Nonce";