Hello - been working on my first small project in Clojure and digging it. One thing I've not been able to determine is if it's possible to access the route parameters in middleware? Any help/pointers appreciated!felix--
You received this message because you are subscribed to the Google Groups "Compojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to compojure+...@googlegroups.com.
To post to this group, send email to comp...@googlegroups.com.
Visit this group at http://groups.google.com/group/compojure?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Visit this group at http://groups.google.com/group/compojure.
--
You received this message because you are subscribed to the Google Groups "Compojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to compojure+...@googlegroups.com.
To post to this group, send email to comp...@googlegroups.com.
Visit this group at http://groups.google.com/group/compojure.
(defroutes api-routes
(context "/admin/v1/apis" [] (auth/wrap-admin admin-routes))
(context "/admin/v1/pages" [] (auth/wrap-admin admin-pages-routes))
(context "/v1/apis" [] (auth/wrap-user v1-api-routes))
(context "/v1/pages" [] v1-pages-routes)
(context "/v1/pubapis" [] v1-pubroutes))
That doesn't work though, because in the case of a resource at (e.g.) /index.html, wrap-force-ssl is still evaulated. The behavior of wrap-force-ssl is such that if the request (and in this case any request) is not via https, then it is redirected to https, which I don't want.
Got it. So my code will look like this(defn post-object [route controller](POST route [& params](controller (convert-object-ids params))))(defn controller [params](response {:foo "bar"}))(defroutes foo
(post-object "/bar" controller))Manually converting objects as I am doing right now, sounds better.
Ah I see. I'm afraid that with the current Compojure architecture, you'll need to either apply wrap-force-ssl individually to each top-level route you want SSL to be forced on, or supply wrap-force-ssl with a set of prefixes or regular expressions.However, in any solution, you need to have some mechanism to tell wrap-force-ssl (or any other middleware) which routes you want to be secure and which you don't.