diff --git a/Cargo.toml b/Cargo.toml index c8f602d..fbdc001 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ lazy_static = { version = "^1.4.0", optional = true } log = { version = "^0.4.17", optional = true } prometheus = { version = "^0.13.1", optional = true } serde = { version = "^1.0.137", features = ["derive"], optional = true } -serde_json = { version = "^1.0.81", features = [ +serde_json = { version = "^1.0.82", features = [ "preserve_order", "float_roundtrip", ], optional = true } diff --git a/src/client/proxy.rs b/src/client/proxy.rs index 8d061cc..bd1b8d8 100644 --- a/src/client/proxy.rs +++ b/src/client/proxy.rs @@ -4,7 +4,7 @@ //! with proxy capabilities use std::{ - fmt::{self, Debug, Display, Formatter}, + fmt::{self, Debug, Display, Formatter, Write}, marker::PhantomData, net::IpAddr, str::FromStr, @@ -40,6 +40,8 @@ pub enum Error { ParseDirect(String), #[error("failed to parse '{0}' as url, {1}")] ParseUrl(String, url::ParseError), + #[error("failed to format query params in url, {0}")] + FormatUrl(fmt::Error), } // ----------------------------------------------------------------------------- @@ -262,7 +264,7 @@ impl ProxyBuilder { let mut p_and_q = url.path().to_string(); if let Some(q) = url.query() { - p_and_q += &format!("?{}", q); + write!(p_and_q, "?{}", q).map_err(Error::FormatUrl)?; } let uri = Uri::builder()