How do I modify session in Ring middleware? I basically want to have a history of accessed urls stored there and I just can't get the session to store values.
Sessions works correctly elsewhere at the code where I can return responses. I assume this has something to do with the issue and I'm not understanding something about how middlewares work.
Here is my current code
(defn wrap-history [handler]
(fn [req]
(handler (assoc-in req [:session :history]
(vec (concat (-> req :session :history) [(request/request-url req)]))))))
Here is the app (I'm using ring-defaults which includes session middleware)
(def app
(-> all-routes
(wrap-history)
(wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false))))
The answer is probably pretty easy (probably something to do with how to return response from middleware instead of request) but I just don't seem to be able to find correct documentation for this..