Empty colon-params are ignored

This commit is contained in:
Tommi Reiman 2019-03-01 22:12:11 +02:00
parent 284d443e30
commit 998bf4a0d4
2 changed files with 10 additions and 1 deletions

View file

@ -64,7 +64,9 @@
(recur (concat ss (-static from to) (-catch-all (inc to) to')) (inc to') (inc to'))
(recur (concat ss (-static from to) (-wild to to')) (inc to') (inc to'))))
\: (let [to' (or (str/index-of s "/" to) (count s))]
(recur (concat ss (-static from to) (-wild to to')) to' to'))
(if (= 1 (- to' to))
(recur ss from (inc to))
(recur (concat ss (-static from to) (-wild to to')) (long to') (long to'))))
\* (let [to' (count s)]
(recur (concat ss (-static from to) (-catch-all to to')) to' to'))
(recur ss from (inc to)))))))

View file

@ -186,3 +186,10 @@
(= out (impl/form-decode in))
"%2B632+905+123+4567" "+632 905 123 4567"))
(deftest parse-test
(is (= (impl/map->Route
{:path "https://google.com"
:path-parts ["https://google.com"]
:path-params #{}})
(impl/parse "https://google.com"))))