We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 99b2254 commit d769f8aCopy full SHA for d769f8a
1 file changed
crates/client/src/dns.rs
@@ -39,6 +39,7 @@ pub(crate) fn validate_and_get_dns_lb(
39
.ok_or_else(|| ClientConnectError::InvalidConfig("target URL has no host".to_owned()))?;
40
41
match host {
42
+ url::Host::Domain("localhost") => Ok(None),
43
url::Host::Domain(_) => Ok(Some(dns_opts)),
44
url::Host::Ipv4(_) | url::Host::Ipv6(_) => Ok(None),
45
}
@@ -285,6 +286,12 @@ mod tests {
285
286
assert!(validate_and_get_dns_lb(&opts).is_err());
287
288
289
+ #[test]
290
+ fn localhost_returns_none() {
291
+ let opts = ConnectionOptions::new(Url::parse("http://localhost:7233").unwrap()).build();
292
+ assert!(validate_and_get_dns_lb(&opts).unwrap().is_none());
293
+ }
294
+
295
#[test]
296
fn endpoint_uri_v4() {
297
let addr: SocketAddr = "1.2.3.4:7233".parse().unwrap();
0 commit comments