Form
provides URL-encoded form body parsing and serialization.
(match (Form.parse "name=carp&version=1")
(Result.Success m) (println* &(Map.get &m "name"))
(Result.Error e) (IO.errorln &e))
encode
(Fn [(Ref (Map String String) a)] String)
(encode m)
encodes a (Map String String) as a URL-encoded form body.
Spaces become + and other special characters are percent-encoded.
This is the inverse of parse.
parse
(Fn [(Ref String a)] (Result (Map String String) b))
(parse s)
parses a URL-encoded form body into a (Map String String).
Keys and values are percent-decoded. The + character is decoded as space
per the application/x-www-form-urlencoded specification.
parse-pairs
(Fn [(Ref String a)] (Result (Array (Pair String String)) b))
(parse-pairs s)
parses a URL-encoded form body into an
(Array (Pair String String)). Unlike parse, this preserves the order
of pairs and allows duplicate keys. Keys and values are percent-decoded.
The + character is decoded as space.