Skip to content

Commit 22fdebc

Browse files
committed
explicitly set response charset to utf-8.
if the charset is not specified on the Content-Type header, it will be determined elsewhere. for example, the tomcat servlet container will default to ISO-8859-1, while jetty will encode application/json in UTF-8. making this explicit (UTF-8 seems like the most sensible default here) eliminates the potential for the sorts of nasty post- deployment surprises one might experience when this setting is left to the whims of an individual servlet container.
1 parent 90b9b35 commit 22fdebc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

build.boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
(require
1111
'[adzerk.bootlaces :refer :all])
1212

13-
(def +version+ "3.0.0-alpha7")
13+
(def +version+ "3.0.0-alpha8")
1414

1515
(bootlaces! +version+)
1616

src/castra/middleware.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
*request* req
122122
*session* (atom (:session req))
123123
*validate-only* (= "true" (get-in req [:headers "x-castra-validate-only"]))]
124-
(let [h (headers req head {"Content-Type" "application/json"})
124+
(let [h (headers req head {"Content-Type" "application/json;charset=utf-8"})
125125
f #(do (csrf!) (do-rpc (vars) (expression body-keys req)))
126126
d (try (response body-keys req {:result (f) :state (when state-fn (state-fn))})
127127
(catch Throwable e

0 commit comments

Comments
 (0)