Does anyone know how to add anti-forgery key to the response header ?
Probably looking for this? https://github.com/ring-clojure/ring-anti-forgery
thank y ou. what I meant was how do I add the token to the header of the response ? I can insert it into the body, but I'm new to this framework and don't know how to manipulate response header.
You can add headers to the response the same as Ring, by adding a :headers
key. I don’t think you need to add the anti-forgery token to the response header though… unless I’m missing something big here.
i'm not sure where to add the response header. I'm returning [::ok (views.index/list-options)] from the handler. But I want to include the anti-forgery token with any response from the server ..this is just to learn... i am trying "DELETE" option from the command line ..but without anti-forgery token, i get an error. So to get anti-forgery token, i want to add it in header of any response from the server.
Hope i'm making sense
Please ignore my question.. I figured it out. I can add a middleware to add the header and that works..probably not the right way, but this returns the anti-forgery-token for all responses instead of just the forms