1mod client;
2
3#[cfg(feature = "host-reqwest")]
4pub mod reqwest;
5
6#[cfg(feature = "js")]
7mod web_http_client;
8
9#[cfg(feature = "js")]
10pub use self::web_http_client::WebHttpClient;
11
12pub use self::client::*;
13
14pub(crate) const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "-", env!("CARGO_PKG_VERSION"));
15
16pub fn default_http_client() -> Option<impl HttpClient + Send + Sync + 'static> {
18 cfg_select! {
19 feature = "host-reqwest" => {
20 Some(self::reqwest::ReqwestHttpClient::default())
21 }
22 feature = "js" => {
23 Some(web_http_client::WebHttpClient::default())
24 }
25 _ => {
26 #[derive(Debug)]
30 enum Unimplemented {}
31 impl HttpClient for Unimplemented {
32 fn request(&self, _request: HttpRequest) -> futures::future::BoxFuture<'_, Result<HttpResponse, anyhow::Error>> {
33 match *self {}
34 }
35 }
36
37 Option::<Unimplemented>::None
38 }
39 }
40}