(defn charset
"Returns an updated Ring response with the supplied charset added to the
Content-Type header."
{:added "1.1"}
[resp charset]
(update-header resp "Content-Type"
(fn [content-type]
(-> (or content-type "text/plain")
(str/replace #";\s*charset=[^;]*" "")
(str "; charset=" charset)))))