This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-12
Channels
- # announcements (13)
- # aws (18)
- # babashka (60)
- # babashka-sci-dev (83)
- # beginners (32)
- # biff (18)
- # calva (22)
- # cider (8)
- # clj-on-windows (101)
- # clojure (59)
- # clojure-bay-area (2)
- # clojure-europe (36)
- # clojure-india (4)
- # clojure-nl (3)
- # clojure-norway (5)
- # clojure-spec (4)
- # clojure-uk (1)
- # clojurescript (5)
- # conjure (1)
- # core-async (10)
- # cursive (7)
- # data-science (5)
- # datahike (10)
- # datalog (11)
- # datomic (3)
- # docker (3)
- # figwheel-main (2)
- # gratitude (3)
- # improve-getting-started (1)
- # introduce-yourself (5)
- # jobs (3)
- # joyride (12)
- # leiningen (1)
- # lsp (67)
- # malli (27)
- # off-topic (36)
- # random (1)
- # rdf (1)
- # re-frame (17)
- # reagent (21)
- # reitit (4)
- # releases (4)
- # remote-jobs (2)
- # ring (2)
- # sci (35)
- # shadow-cljs (28)
- # sql (3)
- # squint (9)
- # tools-deps (11)
Hello! Is the reitit parameters-middleware supposed to convert the parameters into keywords? If not, is there an additional middleware to add to the stack to do this action? I am trying to really learn how reitit and ring work as i build up a custom web server, but am getting a little lost in the middleware stack. My app, looks, essentially, like so:
(def routes
[
["/" {:get (fn [req] (home req))}]
["/login" {:post (fn [req] (login req))}]
])
(def app
(ring/ring-handler
(ring/router routes
{:data {:muuntaja m/instance
:middleware [parameters/parameters-middleware
format-negotiate-middleware
hc/wrap-response-middleware
format-response-middleware
exception-middleware
format-request-middleware]}})
(ring/routes
(ring/create-resource-handler {:path "/"})
(ring/redirect-trailing-slash-handler)
(ring/create-default-handler
{:not-found (constantly {:status 404
:body "<h1>Route not found</h1>"})}))))
When the routes have query-params or form-params, they are included in the request in the appropriate :query-params and :form-params maps, but as strings. Is there a way to have them be keyword maps?
I tried to add the ring middleware wrap-keyword-params
but it didn’t seem to change the behaviour. /login?test=foo adds {:query-params {"test" "foo"}}
to the request map