This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-20
Channels
- # announcements (10)
- # aws (4)
- # babashka (71)
- # beginners (30)
- # calva (61)
- # cherry (1)
- # cider (16)
- # clj-kondo (3)
- # clj-on-windows (4)
- # cljsrn (1)
- # clojure (28)
- # clojure-austin (2)
- # clojure-bay-area (1)
- # clojure-europe (45)
- # clojure-hungary (1)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-sweden (14)
- # clojure-uk (11)
- # clojurescript (39)
- # core-async (3)
- # core-typed (11)
- # datomic (68)
- # fulcro (7)
- # keechma (1)
- # lsp (29)
- # malli (5)
- # off-topic (57)
- # other-languages (13)
- # pathom (4)
- # rdf (7)
- # reagent (7)
- # reitit (6)
- # releases (1)
- # schema (8)
- # shadow-cljs (86)
- # sql (22)
- # squint (1)
- # vim (8)
- # xtdb (12)
I’m writing middleware for ring
that needs access to path-params
. I assume reitit
has some default middleware that is used to attach this data the request object. In my server, the path-params
are available to the handler function when the request object arrives. However, they are not present when I inspect the request object in my middleware function. Is there a best practice way to trigger reitit
adding the path-params
data before the request object arrives to my middleware function? Perhaps inserting the reitit
default middleware explicitly before my middelware?
Great. Do you have any specific details of which middleware generates the path-params
value? I was digging through the code but all I could find was in a wrapper around the handler which appears to get invoked right before the handler is called. Didn’t seem like that was configurable.
I think it is one of the middlewares that is supplied as part of ring/ring-defaults
, but I don’t remember off the top of my head which one.
That may not be helpful to you if you are not using ring-defaults. But here is another idea, something I was just reading about the other day. Look under reitit’s documentation for middleware transformation. They provide a transform function that will show you incremental diff’s of the request
as each middleware performs its changes. That will let you narrow down exactly where things are happening.
thank you!