(get-charset {:keys [content-type]})
Extracts charset from Content-Type header. utf-8 by default.
Extracts charset from Content-Type header. utf-8 by default.
(json-parse-string s)
(make-type-request-pred regexp)
Function that returns a predicate fn checking if Content-Type request header matches a specified regexp and body is set.
Function that returns a predicate fn checking if *Content-Type* request header matches a specified regexp and body is set.
(wrap-format-params handler & {:keys [predicate decoder charset]})
Wraps a handler such that requests body are deserialized from to the right format, added in a :body-params key and merged in :params. It takes 3 args: :predicate is a predicate taking the request as sole argument to test if deserialization should be used. :decoder specifies a fn taking the body String as sole argument and giving back a hash-map. :charset can be either a string representing a valid charset or a fn taking the req as argument and returning a valid charset.
Wraps a handler such that requests body are deserialized from to the right format, added in a :body-params key and merged in :params. It takes 3 args: :predicate is a predicate taking the request as sole argument to test if deserialization should be used. :decoder specifies a fn taking the body String as sole argument and giving back a hash-map. :charset can be either a string representing a valid charset or a fn taking the req as argument and returning a valid charset.
(wrap-json-params
handler
&
{:keys [predicate decoder charset]
:or {predicate json-request? decoder json-parse-string charset get-charset}})
Handles body params in JSON format. See wrap-format-params for details.
Handles body params in JSON format. See wrap-format-params for details.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close