Form

provides helpers for parsing application/x-www-form-urlencoded request bodies.

decode

defn

(Fn [(Ref String a)] (Map String String))

                        (decode body)
                    

decode-request

defn

(Fn [(Ref Request a)] (Map String String))

                        (decode-request req)
                    

parse

defn

(Fn [(Ref String a)] (Result (Map String String) b))

                        (parse s)
                    

parses a URL-encoded form body into a (Map String String).

(let [data (Form.decode (Request.body req))]
  (Map.get &data "username"))

Keys and values are URL-decoded. Duplicate keys keep the last value.

parse-request

meta-stub

a

parses the form body from a request. Returns an empty map if the content type is not application/x-www-form-urlencoded.