diff --git a/lib/src/connection.rs b/lib/src/connection.rs index e5ba8679..ac148206 100644 --- a/lib/src/connection.rs +++ b/lib/src/connection.rs @@ -179,7 +179,9 @@ impl NeoUrl { let url = match Url::parse(uri) { Ok(url) if url.has_host() => url, // missing scheme - Ok(_) => Url::parse(&format!("bolt://{}", uri))?, + Ok(_) | Err(url::ParseError::RelativeUrlWithoutBase) => { + Url::parse(&format!("bolt://{}", uri))? + } Err(err) => return Err(Error::UrlParseError(err)), }; @@ -296,4 +298,12 @@ mod tests { assert_eq!(url.host(), Host::Domain("localhost")); assert_eq!(url.scheme(), "bolt"); } + + #[test] + fn should_parse_ip_uri_without_scheme() { + let url = NeoUrl::parse("127.0.0.1:4242").unwrap(); + assert_eq!(url.port(), 4242); + assert_eq!(url.host(), Host::Domain("127.0.0.1")); + assert_eq!(url.scheme(), "bolt"); + } }