URL¶
Parse URL strings into their components.
Supports http and https schemes. Validates the scheme, host, and port;
rejects URLs with userinfo (user:pass@host). Fragments are silently
discarded.
match URL.parse("https://example.com:8443/api/v1?key=value")
| let url: ParsedURL =>
// url.scheme == SchemeHTTPS
// url.host == "example.com"
// url.port == "8443"
// url.path == "/api/v1"
// url.query == "key=value"
// url.request_path() == "/api/v1?key=value"
// url.is_ssl() == true
| let err: URLParseError =>
// handle error
end
Constructors¶
create¶
Returns¶
- URL val^
Public Functions¶
parse¶
Parse a URL string into its components, or return an error.
fun box parse(
url: String val)
: (ParsedURL val | MissingScheme val | UnsupportedScheme val |
MissingHost val | InvalidPort val | UserInfoNotSupported val)
Parameters¶
- url: String val
Returns¶
- (ParsedURL val | MissingScheme val | UnsupportedScheme val | MissingHost val | InvalidPort val | UserInfoNotSupported val)
eq¶
Parameters¶
- that: URL val
Returns¶
- Bool val
ne¶
Parameters¶
- that: URL val
Returns¶
- Bool val