use super::Client;
use crate::net::{NetworkError, protocols::http::HttpAuto};
impl Client {
#[allow(unused)]
pub async fn http_request<T>(
&self,
request: hyper::Request<T>,
#[cfg(all(feature = "net_protocol_http2", feature = "net_protocol_http1"))] http2_prior_knowledge: bool,
) -> Result<hyper::Response<hyper::body::Incoming>, NetworkError>
where
T: hyper::body::Body + Send + Unpin + std::fmt::Debug + 'static,
T::Data: Send,
T::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
{
match self {
#[cfg(feature = "net_interface_clear")]
Client::Clear(clear) => {
clear
.send_request(
request,
#[cfg(all(feature = "net_protocol_http2", feature = "net_protocol_http1"))]
http2_prior_knowledge,
)
.await
}
#[cfg(feature = "net_interface_tor")]
Client::Tor(tor) => {
tor.send_request(
request,
#[cfg(all(feature = "net_protocol_http2", feature = "net_protocol_http1"))]
http2_prior_knowledge,
)
.await
}
#[cfg(all(not(feature = "net_interface_clear"), not(feature = "net_interface_tor")))]
_ => compile_error!("At least one network interface must be enabled."),
}
}
}