reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
kenny 2020-08-29T18:55:04.052Z

When matching a catch all path by name, should reitit url encode the path? It seems like it should not. Below is the actual result.

(r/match->path 
  (r/match-by-name
   (r/router ["/a/{*rest}" ::a])
   ::a
   {:rest "foo/bar"}))
=> "/a/foo%2Fbar"
I would’ve expected “/a/foo/bar”

kenny 2020-09-01T16:49:39.022500Z

fyi, made an issue for this https://github.com/metosin/reitit/issues/432

ikitommi 2020-08-29T19:15:02.052100Z

good catch. How do other routing libs handle that?

ikitommi 2020-08-29T19:15:59.052300Z

what if you give {:rest "foo/bar?a=1"}?

kenny 2020-08-29T19:16:42.052500Z

I’m not sure how they handle it.

(r/match->path
  (r/match-by-name
    (r/router ["/a/{*rest}" ::a])
    ::a
    {:rest "foo/bar?a=1"}))
=> "/a/foo%2Fbar%3Fa%3D1"