This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-19
Channels
- # beginners (37)
- # boot (96)
- # cider (23)
- # clara (2)
- # cljs-dev (40)
- # clojars (1)
- # clojure (149)
- # clojure-conj (1)
- # clojure-dev (2)
- # clojure-dusseldorf (5)
- # clojure-france (82)
- # clojure-italy (1)
- # clojure-nlp (1)
- # clojure-russia (13)
- # clojure-spec (24)
- # clojure-uk (62)
- # clojurescript (131)
- # core-async (13)
- # core-logic (7)
- # data-science (1)
- # datomic (10)
- # defnpodcast (3)
- # docker (4)
- # emacs (3)
- # events (4)
- # hoplon (68)
- # klipse (4)
- # leiningen (1)
- # off-topic (5)
- # om (140)
- # onyx (16)
- # pedestal (24)
- # planck (10)
- # proton (2)
- # re-frame (9)
- # reagent (4)
- # remote-jobs (1)
- # ring-swagger (16)
- # untangled (5)
- # vim (8)
- # yada (30)
So url-for-routes
omits trailing /
which are part of my URL. Is this intentional or a bug?
@rauh Interesting... I think that has to do with the path parsing. The trailing /
probably gets turned into an empty string in the route's :path-parts
. Running a check to verify that now.
@rauh Nope, I was wrong. The trailing slash gets elided completely when parsing the route. So by the time you call url-for-routes
, there's nothing there to represent that slash.
OK, so I just confirmed. The router doesn't affect url-for-routes. Which route syntax are you using?
((router/url-for-routes
(table/table-routes
[["/api/"
:get identity
:route-name :x]]))
:x)
;; => "/api"
=> ({:path "/api/", :method :get, :path-re #"/\Qapi\E", :path-parts ["api"], :interceptors [#Interceptor{:name }], :route-name :x, :path-params []})
OK, now I see what’s going on. The map-tree router uses :path to match, whereas the prefix-tree and linear-search use :path-re