Http.Query
URI query and application/x-www-form-urlencoded
codec.
Encodes and decodes according to the whatwg URL standard.
The type for queries as key-values maps. Both keys and values are properly decoded. Note that keys can map to multiple values.
val empty : t
empty
is the empty key-values map.
val mem : string -> t -> bool
mem k q
is true iff
key k
is bound in q
.
add k v q
is q
with value v
appended to k
's values (or set
if there was no binding for k
).
val find : string -> t -> string option
find k q
is the value of k
's first binding in q
, if any.
val find_all : string -> t -> string list
find_all k q
are all the values bound to k
or the empty list if k
is unbound.
val fold : (string -> string -> 'a -> 'a) -> t -> 'a -> 'a
fold f q acc
folds over all the key-value bindings. For keys with multiple values folds over them in the same order as find_all
.
keep_only_first q
is q
with only the first value kept in bindings with multiple values.
val decode : string -> t
val encode : t -> string
encode q
encodes q
to an application/x-www-form-urlencoded
string.
val pp : Stdlib.Format.formatter -> t -> unit
pp
is an unspecified formatter for queries.