Module Http.Query
URI query and application/x-www-form-urlencoded
codec.
Encodes and decodes according to the whatwg URL standard.
Queries
type t
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 trueiff
keyk
is bound inq
.
val add : string -> string -> t -> t
add k v q
isq
with valuev
appended tok
's values (orset
if there was no binding fork
).
val find : string -> t -> string option
find k q
is the value ofk
's first binding inq
, if any.
val find_all : string -> t -> string list
find_all k q
are all the values bound tok
or the empty list ifk
is unbound.
Converting
val decode : string -> t
decode s
decodes theapplication/x-www-form-urlencoded
s
to a query. If a key is defined more than once, the first definition is returned byfind
and the left-to-right order preserved byfind_all
's list. The input string is not checked for UTF-8 validity.
val encode : t -> string
encode q
encodesq
to anapplication/x-www-form-urlencoded
string.
val pp : Stdlib.Format.formatter -> t -> unit
pp
is an unspecified formatter for queries.