Fork me on GitHub
Danny Almeida06:02:28

Does anyone know how to add anti-forgery key to the response header ?

Danny Almeida22:02:18

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.

Danny Almeida21:02:32

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.

Danny Almeida21:02:39

Hope i'm making sense

Danny Almeida03:02:30

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