uri
ModuleURIs, split and normalised the way requests and redirects need them.
Contents
use utopia_client::Uri;Rust
pub struct UriA URI: scheme, user info, host, port, path, query and fragment.
Parsing lowercases the scheme and host and percent-encodes any byte a
path, query or fragment may not hold as is (a % that does not start an
escape included), so every Uri prints as a valid URI. A default port
(80 for http, 443 for https) is dropped.
Rust
use utopia_client::Uri;
let uri = Uri::parse("HTTPS://API.Example.com:443/v1/users?q=a b#top")?;
assert_eq!(uri.host(), "api.example.com");
assert_eq!(uri.port(), None);
assert_eq!(uri.to_string(), "https://api.example.com/v1/users?q=a%20b#top");Also implements
Display, FromStr.