>From the ring-anti-forgery tests [1] I see that it expects the token to be both in the session under the `::af/anti-forgery-token` key and in the `:form-params` in the request as `__anti-forgery-token`, so you can do something like:
``` (require '[ring.middleware.anti-forgery :as af]) (deftest my-handler-test (is (= 200 (-> (request :post "/") (assoc :session {::af/anti-forgery-token "foo"}) (assoc :form-params {"__anti-forgery-token" "foo"}) my-handler :status)))) ``` Hope it helps [1]: https://github.com/ring-clojure/ring-anti-forgery/blob/master/test/ring/middleware/test/anti_forgery.clj#L16-L18 - Nicolás On Sun, Sep 6, 2015 at 12:53 PM, Mathieu <corbin.m...@gmail.com> wrote: > I want to test a compojure webapp, but i don't know how to use > Ring-Anti-Forgery inside Ring-Mock. Actually, all my post requests in my > test return 403. > > Any idea ? > > Thanks > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.