File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -156,11 +156,29 @@ third-party strategies already exist:
156156## Caveats
157157
158158This middleware will prevent all HTTP methods except for GET and HEAD
159- from accessing your handler without a valid anti-forgery token.
159+ from accessing your handler without a valid anti-forgery token, or a
160+ custom header if the ` :safe-header ` option is set.
160161
161162You should therefore only apply this middleware to the parts of your
162163application designed to be accessed through a web browser. This
163- middleware should not be applied to handlers that define web services.
164+ middleware should not be applied to handlers that define web services
165+ intended for access outside of the browser.
166+
167+ Also note that the default session strategy modifies the session. As
168+ with all Ring applications, care should be taken not to override the
169+ request session:
170+
171+ ``` clojure
172+ ; ; This will overwrite all existing values in the session
173+ (defn bad-handler [_request]
174+ {:status 200 , :headers {}, :body " foo = 1"
175+ :session {:foo 1 }})
176+
177+ ; ; This will only update the :foo key in the session
178+ (defn good-handler [{:keys [session]}]
179+ {:status 200 , :headers {}, :body " foo = 1"
180+ :session (assoc session :foo 1 )})
181+ ```
164182
165183## License
166184
You can’t perform that action at this time.
0 commit comments