Skip to content

URL

[Source]

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
primitive val URL

Constructors

create

[Source]

new val create()
: URL val^

Returns


Public Functions

parse

[Source]

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

Returns


eq

[Source]

fun box eq(
  that: URL val)
: Bool val

Parameters

  • that: URL val

Returns


ne

[Source]

fun box ne(
  that: URL val)
: Bool val

Parameters

  • that: URL val

Returns