This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-08
Channels
- # adventofcode (55)
- # announcements (21)
- # babashka (20)
- # beginners (89)
- # calva (21)
- # cider (16)
- # circleci (11)
- # clara (8)
- # clj-kondo (6)
- # clojure (31)
- # clojure-australia (3)
- # clojure-europe (17)
- # clojure-nl (5)
- # clojure-uk (10)
- # clojurescript (25)
- # community-development (4)
- # conjure (12)
- # cryogen (28)
- # cursive (21)
- # datomic (7)
- # deps-new (1)
- # depstar (45)
- # emacs (5)
- # fulcro (46)
- # instaparse (5)
- # jobs (5)
- # jobs-discuss (23)
- # kaocha (12)
- # lambdaisland (2)
- # leiningen (1)
- # meander (10)
- # mid-cities-meetup (1)
- # reagent (5)
- # reitit (5)
- # remote-jobs (45)
- # reveal (9)
- # sql (6)
- # tools-deps (103)
- # uncomplicate (1)
- # xtdb (1)
Hi, I've seen some reitit handlers extract the following keys from request
:
{:keys [path-params query-params body-params]}
Yet when I inspect my request map I only see
:query-string
:path-params
:body
Does anyone know the reason for this discrepancy? Am I on the wrong version of reitit? I'm using [metosin/reitit "0.5.10"]
query-params
are added by https://github.com/metosin/reitit/blob/master/modules/reitit-middleware/src/reitit/ring/middleware/parameters.clj middleware, and body-params
are added by https://github.com/metosin/reitit/blob/master/modules/reitit-middleware/src/reitit/ring/middleware/muuntaja.clj#L58 middleware 🙂 You can see in https://github.com/metosin/reitit/blob/master/examples/ring-spec-swagger/src/example/server.clj#L86 example how they are added
It's perhaps also worth noting that query-params
can come from the https://github.com/ring-clojure/ring/blob/1.7.0/ring-core/src/ring/middleware/params.clj#L48 that does the same. You don't have to use the reitit
middlewares, but they are data-driven so they play nicely with the middleware chain.
It's the same with body-params
. We have our own middleware that handles JSON parsing (i.e. we're not using muuntaja for historical reasons), but we inject the data into :body-params
so that we can leverage reitit
coercion to inspect and coerce the data therein
It's really up to you!