Parses the cookies in the request map, then assocs the resulting map
to the :cookies key on the request.
(defn wrap-cookies
"Parses the cookies in the request map, then assocs the resulting map
to the :cookies key on the request."
[handler]
(fn [request]
(let [request (if (request :cookies)
request
(assoc request :cookies (parse-cookies request)))]
(-> (handler request)
(set-cookies)
(dissoc :cookies)))))
Comments top
No comments for wrap-cookies. Log in to add a comment.