Created
July 25, 2011 03:44
-
-
Save ibdknox/1103525 to your computer and use it in GitHub Desktop.
middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(server/add-middleware my-middleware) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn wrap-utf-8 | |
"Adds the 'charset=utf-8' clause onto the content type declaration, | |
allowing pages to display all utf-8 characters." | |
[handler] | |
(fn [request] | |
(let [resp (handler request) | |
ct (get-in resp [:headers "Content-Type"]) | |
neue-ct (str ct "; charset=utf-8")] | |
(assoc-in resp [:headers "Content-Type"] neue-ct)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment