Skip to content

Commit

Permalink
update reqwest dependency and add re-export reqwest::Client
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwample committed Feb 21, 2025
1 parent 6cc391c commit 47b167c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ semver = { version = "1.0", default-features = false }
# Optional dependencies
async-tungstenite = { version = "0.24", default-features = false, features = ["tokio-runtime", "tokio-rustls-native-certs"], optional = true }
futures = { version = "0.3", optional = true, default-features = false }
reqwest = { version = "0.11.20", optional = true, default-features = false, features = ["rustls-tls-native-roots"] }
reqwest = { version = "0.12.12", optional = true, default-features = false, features = ["rustls-tls-native-roots"] }
structopt = { version = "0.3", optional = true, default-features = false }
tokio = { version = "1.0", optional = true, default-features = false, features = ["rt-multi-thread"] }
tracing = { version = "0.1", optional = true, default-features = false }
Expand Down
11 changes: 7 additions & 4 deletions rpc/src/client/transport/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ use super::auth;

const USER_AGENT: &str = concat!("tendermint.rs/", env!("CARGO_PKG_VERSION"));

/// `reqwest` http client re-exported for compatibility convenience
pub type ReqwestClient = reqwest::Client;

/// A JSON-RPC/HTTP Tendermint RPC client (implements [`crate::Client`]).
///
/// Supports both HTTP and HTTPS connections to Tendermint RPC endpoints, and
Expand Down Expand Up @@ -50,7 +53,7 @@ const USER_AGENT: &str = concat!("tendermint.rs/", env!("CARGO_PKG_VERSION"));
/// ```
#[derive(Debug, Clone)]
pub struct HttpClient {
inner: reqwest::Client,
inner: ReqwestClient,
url: reqwest::Url,
compat: CompatMode,
}
Expand All @@ -62,7 +65,7 @@ pub struct Builder {
proxy_url: Option<HttpClientUrl>,
user_agent: Option<String>,
timeout: Duration,
client: Option<reqwest::Client>,
client: Option<ReqwestClient>,
}

impl Builder {
Expand Down Expand Up @@ -105,7 +108,7 @@ impl Builder {
/// ## Warning
/// This will override the following options set on the builder:
/// `timeout`, `user_agent`, and `proxy_url`.
pub fn client(mut self, client: reqwest::Client) -> Self {
pub fn client(mut self, client: ReqwestClient) -> Self {
self.client = Some(client);
self
}
Expand Down Expand Up @@ -146,7 +149,7 @@ impl HttpClient {
/// Construct a new Tendermint RPC HTTP/S client connecting to the given
/// URL. This avoids using the `Builder` and thus does not perform any
/// validation of the configuration.
pub fn new_from_parts(inner: reqwest::Client, url: reqwest::Url, compat: CompatMode) -> Self {
pub fn new_from_parts(inner: ReqwestClient, url: reqwest::Url, compat: CompatMode) -> Self {
Self { inner, url, compat }
}

Expand Down

0 comments on commit 47b167c

Please sign in to comment.