jumblerg/ring-cors

CORS on POST

Closed this issue · 1 comments

I'm playing around with ring and as soon as I went from testing with curl I ran into my browser complaining about CORS on GET requests. I put ring.middleware.cors to use (I think the following are the only relevant bits):

(defroutes app-routes
  (context "/swap" []
    (POST "/auth" req (do-auth (:kw-body req)))
    (POST "/renew-token" req (do-renew-token (:kw-body req)))
    (GET "/groups" [] (do-groups))
    (POST "/swap" req (do-swap (:kw-body req))))

(defroutes app
  (-> app-routes
      (cors/wrap-cors identity)
      wrap-log-request
      wrap-json-response
      wrap-kwjson-body
      wrap-json-body))

That works great for GET, but not for POST! How do I accept all POST reqs, no matter the source?

Probably this is related to something else. I'll investigate a bit more.