Module Brr.Uri

URIs.

Note. Built on top of the URL API, but we return data according to RFC 3986 terminology. This means we don't return separators like ':', '?' and '#' in the data.

URIs

type t

The type for URIs.

val scheme : t -> Jstr.t

scheme u is the scheme of u.

val host : t -> Jstr.t

host u is the host of u (Note this is what JavaScript calls hostname).

val port : t -> int option

port u is the port of u.

val path : t -> Jstr.t

path u is the path of u.

val query : t -> Jstr.t

query u is the query of u.

val fragment : t -> Jstr.t

fragment u is fragment of u.

val with_uri : ?⁠scheme:Jstr.t -> ?⁠host:Jstr.t -> ?⁠port:int option -> ?⁠path:Jstr.t -> ?⁠query:Jstr.t -> ?⁠fragment:Jstr.t -> t -> t

with_uri u is u with the specified components updated.

Converting

val of_jstr : Jstr.t -> t option

of_jstr s is an URL from s.

val to_jstr : t -> Jstr.t

to_jstr u is u as a JavaScript string.