module Uri:sig
..end
type
t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
typecomponent =
[ `Authority
| `Fragment
| `Host
| `Path
| `Query
| `Query_key
| `Query_value
| `Scheme
| `Userinfo ]
val component_of_sexp : Sexplib.Sexp.t -> component
val __component_of_sexp__ : Sexplib.Sexp.t -> component
val sexp_of_component : component -> Sexplib.Sexp.t
val empty : t
val compare : t -> t -> int
val equal : t -> t -> bool
equal a b
is compare a b = 0
.val pct_encode : ?scheme:string -> ?component:component -> string -> string
scheme
argument defaults to 'http' and
the component
argument defaults to `Pathval pct_decode : string -> string
val of_string : string -> t
val to_string : t -> string
val resolve : string -> t -> t -> t
val canonicalize : t -> t
val make : ?scheme:string ->
?userinfo:string ->
?host:string ->
?port:int ->
?path:string ->
?query:(string * string list) list -> ?fragment:string -> unit -> t
The query string API attempts to accommodate conventional query
string representations (i.e. ?key0=value0&key1=value1
) while
maximally exposing any meaning in those representations. For
example, it is not necessarily the case that /
and /?
are
equivalent to a web server. In the former case, we observe a zero
query string whereas in the latter case, we observe a query string
with a single key, ""
and a zero value. Compare this with /?=
which has a single key and a single empty value,
""
. Additionally, some query functions return lists of values
for a key. These list values are extracted from a single key
with a comma-separated value list. If a query string has multiple
identical keys, you must use Uri.query
to retrieve the entirety of
the structured query string.
val query : t -> (string * string list) list
val verbatim_query : t -> string option
Uri.query
and Uri.encoded_of_query
val encoded_of_query : ?scheme:string -> (string * string list) list -> string
val query_of_encoded : string -> (string * string list) list
val with_query : t -> (string * string list) list -> t
val with_query' : t -> (string * string) list -> t
val get_query_param' : t -> string -> string list option
get_query_param' q key
returns the list of values for the
key
parameter in query q
. Note that an empty list is not the
same as a None
return value. For a query foo
, the mapping is:/
returns None/?foo
returns Some []/?foo=
returns Some [""]
/?foo=bar
returns Some ["bar"]
/?foo=bar,chi
returns Some ["bar","chi"]
Uri.query
instead.val get_query_param : t -> string -> string option
get_query_param q key
returns the value found for a key
in
query q
. If there are multiple values for the key, then the
first one is returned.val add_query_param : t -> string * string list -> t
val add_query_param' : t -> string * string -> t
val add_query_params : t -> (string * string list) list -> t
val add_query_params' : t -> (string * string) list -> t
val remove_query_param : t -> string -> t
val path : t -> string
val path_and_query : t -> string
val with_path : t -> string -> t
val scheme : t -> string option
val with_scheme : t -> string option -> t
scheme
.
Input URI is not modifiedval userinfo : t -> string option
val with_userinfo : t -> string option -> t
string option
.
If no host is present in the supplied URI, an empty host is added.
Input URI is not modified.val user : t -> string option
val password : t -> string option
val with_password : t -> string option -> t
string option
.
If no host is present in the supplied URI, an empty host is added.
Input URI is not modified.val host : t -> string option
val with_host : t -> string option -> t
val host_with_default : ?default:string -> t -> string
val port : t -> int option
val with_port : t -> int option -> t
val fragment : t -> string option
val with_fragment : t -> string option -> t
val pp_hum : Format.formatter -> t -> unit