This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-12
Channels
- # babashka (4)
- # beginners (49)
- # biff (17)
- # calva (12)
- # cider (5)
- # clojure-czech (1)
- # clojure-europe (3)
- # clojure-norway (3)
- # core-logic (1)
- # cursive (4)
- # data-science (2)
- # datalevin (7)
- # emacs (1)
- # events (6)
- # fulcro (11)
- # helix (7)
- # hyperfiddle (30)
- # lsp (4)
- # podcasts-discuss (1)
- # practicalli (4)
- # releases (1)
- # remote-jobs (7)
- # ring (6)
- # spacemacs (4)
- # tools-deps (5)
I’m trying to understand how the :context
key for a ring request is handled by compojure. I can see that it’s read here https://github.com/weavejester/compojure/blob/1f921964801ef4ba45b7e694bc9c6a27394c1300/src/compojure/core.clj#L258 and passed on here https://github.com/weavejester/compojure/blob/1f921964801ef4ba45b7e694bc9c6a27394c1300/src/compojure/core.clj#L264, but I can’t really see where its value is used. The reason why I’m asking is that I have set the :context
myself for another purpose, which completely broke my app. Now I’m trying to figure out where the breaking happens.
The context
macro in Compojure, and the set-context
function in Ring, split the :uri
of a request map into a :context
and :path-info
parts.
So for example:
(compojure/context "/foo"
(compojure/GET "/bar" []
"This will match /foo/bar. The context is /foo, and the path-info is /bar"))
Thanks! I was able to figure out that setting :context
myself broke metosin's ring-swagger library. But I managed to solve it. 🙂
Also, if I read the source right, the context
let-binding is never used? https://github.com/weavejester/compojure/blob/1f921964801ef4ba45b7e694bc9c6a27394c1300/src/compojure/core.clj#L258