This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-29
Channels
- # beginners (1)
- # cider (7)
- # cljsrn (6)
- # clojars (3)
- # clojure (35)
- # clojure-nl (2)
- # clojure-spec (5)
- # clojure-uk (9)
- # clojurescript (18)
- # clojurex (1)
- # community-development (2)
- # cursive (27)
- # datomic (12)
- # duct (11)
- # emacs (5)
- # hoplon (5)
- # immutant (2)
- # leiningen (1)
- # luminus (15)
- # nyc (1)
- # om (9)
- # om-next (5)
- # onyx (55)
- # parinfer (1)
- # re-frame (3)
- # reagent (44)
- # reitit (11)
- # ring-swagger (4)
- # shadow-cljs (25)
- # videos (1)
Hi, I'm trying to get the example from the following page to work https://metosin.github.io/reitit/parameter_coercion.html
Actually, the one from here https://github.com/metosin/reitit/blob/master/README.md that has the route /api/math
.
When I call it using the provided request
(app {:request-method :get
:uri "/api/math"
:query-params {:x "1", :y "2"}})
it works well, but I can't seem to call it using an actual http request from outside the application. I am using immutant, passing the handler like this: (immutant/run (fn [request](app request)) {:port 3000})
. The error I get is java.lang.IllegalStateException: Can't coerce body of type class clojure.lang.PersistentArrayMap
. I wasn't able to find any examples where the call is made through an actual http client; in the examples the handler is always used by just calling it from the repl.
@sokoli.mic reitit doesn’t have all the batteries needed, it’s just a routing lib - so you need some extra middleware to encode & decode params. There are samples under examples
, like https://github.com/metosin/reitit/tree/master/examples/ring-swagger.