Closed alvinfrancis closed 7 years ago
You can escape colons. Just use \
:
user=> (use 'compojure.core)
nil
user=> (def r (GET "/\\:foo" [] "foo"))
#'user/r
user=> (r {:request-method :get, :uri "/:foo"})
{:status 200, :headers {"Content-Type" "text/html; charset=utf-8"}, :body "foo"}
user=> (r {:request-method :get, :uri "/foo"})
nil
Ah. My bad. I was having a problem with regards to it using compojure-api. In particular, the swagger ui was incorrectly showing the URI matches no matter what sort of escaping I did on the colons. I had thought that since it was built on top of this library, the problem would be here. It looks like it's purely on its swagger ui code though since it's matching it properly.
Thanks for the help!
Currently, there doesn't seem to be any way to have a colon in the route. It would be useful to have an easy way to escape colons when you want colons as part of the route path instead of being used for URI matching; colons being valid characters for URLs.