noir.core/url-for doesn't work for wildcards in routes
Closed this issue · 2 comments
smee commented
A route definition with a wildcard can't be referenced via noir.core/url-for.
Example page definition:
(defpage wildcard-page "/foo/*/bar" {args :*}
[:p args])
Example url-for call:
(url-for wildcard-page {:* "baz"})
Expected result: "/foo/baz/bar", but I get "/foo/*/bar"
ibdknox commented
added to 1.2.2-SNAPSHOT, though are you sure * is what you really want there? That will allow arbitrary depth for your segments:
(defpage "/boo/*/bar" [] "yo") ;; wil match /boo/hey/whats/up/bar
(defpage "/boo/:seg/bar" [] "yo2") ;; will only match /boo/hey/bar
smee commented
Thanks, and yes: it's what I want :) I'm currently using noir for a REST like api with resources that contain dots, e.g. like an ip. As clout seems to use dots as a separator like slashes I need to use a wildcard to match these resources.