duct

Danny Almeida 2020-02-15T06:06:28.053600Z

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

kwrooijen 2020-02-15T11:54:20.053700Z

Probably looking for this? https://github.com/ring-clojure/ring-anti-forgery

Danny Almeida 2020-02-15T22:26:18.054Z

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.

2020-02-17T13:27:38.054800Z

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 Almeida 2020-02-18T21:38:32.059500Z

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 Almeida 2020-02-18T21:38:39.059700Z

Hope i'm making sense

Danny Almeida 2020-02-19T03:21:30.059900Z

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