use crate::service::HttpService;
pub enum Either<A, B> {
A(A),
B(B),
}
impl<B, S1, S2> HttpService<B> for Either<S1, S2>
where
B: Send,
S1: HttpService<B>,
S2: HttpService<B, ResponseBody = S1::ResponseBody>,
{
type ResponseBody = S1::ResponseBody;
async fn call(&self, request: http::Request<B>) -> http::Response<Self::ResponseBody> {
match self {
Either::A(svc) => svc.call(request).await,
Either::B(svc) => svc.call(request).await,
}
}
}