Closed Sleepful closed 4 months ago
This example would have made it clear:
;; middleware example with ring-anti-forgery
(defn attach-anti-forgery [handler]
(fn [request]
(let [response (handler request)
response (assoc response :cookies {"acsrf" {:value *anti-forgery-token* :path "/"}})]
response)))
Adding extra examples to the Wiki sounds like a good idea, but that doesn't require a PR - you can just edit the Wiki.
I don't see anything wrong with the docstring, though. It says to add a map to the :cookies key, but you added a string. Maybe it would be clearer with an example, but a docstring isn't the place for comprehensive examples; it needs to be relatively concise.
https://ring-clojure.github.io/ring/ring.middleware.cookies.html#var-wrap-cookies
it says:
however it was not clear, and I tried setting a string for a bit to no avail:
Perhaps just adding an example to the docs+wiki would be nice. I can PR it later.