mod get;
#[cfg(feature = "metrics")]
mod metrics_client;
use bytes::Bytes;
use http::{HeaderMap, Request, StatusCode};
use crate::platform::{MaybeSend, MaybeSendSync};
pub(crate) use get::{GetError, get};
#[cfg(feature = "metrics")]
pub use metrics_client::MetricsHttpClient;
pub trait HttpClient: MaybeSendSync {
type Response: HttpResponse<Error = Self::ResponseError>;
type Error: crate::Error;
type ResponseError: crate::Error;
fn execute(
&self,
request: Request<Bytes>,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + MaybeSend;
fn uses_mtls(&self) -> bool {
false
}
}
pub trait HttpResponse: MaybeSendSync {
type Error: crate::Error;
fn status(&self) -> StatusCode;
fn headers(&self) -> HeaderMap;
fn body(self) -> impl Future<Output = Result<Bytes, Self::Error>> + MaybeSend;
}