Fork me on GitHub
#reitit
<
2020-08-29
>
kenny18:08:04

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”

ikitommi19:08:02

good catch. How do other routing libs handle that?

ikitommi19:08:59

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

kenny19:08:42

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"