mirror of
https://github.com/metosin/reitit.git
synced 2025-12-23 10:41:10 +00:00
Merge pull request #466 from metosin/feature/space-as-separator
Allow space as separator, fixes #411
This commit is contained in:
commit
eb10af92c4
2 changed files with 12 additions and 3 deletions
|
|
@ -167,7 +167,7 @@
|
|||
(instance? CatchAll path)
|
||||
(assoc-in node [:catch-all path] (-node {:params params, :data data}))
|
||||
|
||||
(str/blank? path)
|
||||
(empty? path)
|
||||
(-insert node ps fp params data)
|
||||
|
||||
:else
|
||||
|
|
@ -439,7 +439,9 @@
|
|||
["/v1/topics" 54]
|
||||
["/v1/orgs" 55]
|
||||
["/v1/users/:user-id/bookmarks" 56]
|
||||
["/v1/orgs/:org-id/topics" 57]]
|
||||
["/v1/orgs/:org-id/topics" 57]
|
||||
["/command1 {arg1} {arg2}" ::cmd1]
|
||||
["/command2 {arg1} {arg2} {arg3}" ::cmd2]]
|
||||
(insert)
|
||||
(compile)
|
||||
(pretty)))
|
||||
|
|
|
|||
|
|
@ -121,4 +121,11 @@
|
|||
(trie/compile)
|
||||
(trie/path-matcher)) "/a")]
|
||||
(is (record? (:params match)))
|
||||
(is (= (trie/->Match {:a "a"} {:a 1}) (update match :params (partial into {})))))))
|
||||
(is (= (trie/->Match {:a "a"} {:a 1}) (update match :params (partial into {}))))))
|
||||
|
||||
(testing "space as separator"
|
||||
(is (= (trie/->Match {:arg1 "say" :arg2 "hello"} ::cmd1)
|
||||
((-> (trie/insert nil "/command1 {arg1} {arg2}" ::cmd1)
|
||||
(trie/insert "/command2 {arg1} {arg2} {arg3}" ::cmd2)
|
||||
(trie/compile)
|
||||
(trie/path-matcher)) "/command1 say hello")))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue