summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reverse_routing/core.clj3
-rw-r--r--test/reverse_routing/core_test.clj6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/reverse_routing/core.clj b/src/reverse_routing/core.clj
index 377d75e..2907fb4 100644
--- a/src/reverse_routing/core.clj
+++ b/src/reverse_routing/core.clj
@@ -43,7 +43,8 @@
path-keys (vec (:keys (clout.core/route-compile string-path)))
keylen (count path-keys)
lookup-fn `(fn [[route-name# args-count#]]
- (let [r# (#'lookup-route [route-name# (- args-count# ~keylen)]
+ (let [~args (repeat nil) ;; hacky, but necessary - provide nil values for args
+ r# (#'lookup-route [route-name# (- args-count# ~keylen)]
~@routes)
{uri# :uri, args# :args} r#]
(if r#
diff --git a/test/reverse_routing/core_test.clj b/test/reverse_routing/core_test.clj
index 5dc50ba..8752de9 100644
--- a/test/reverse_routing/core_test.clj
+++ b/test/reverse_routing/core_test.clj
@@ -56,11 +56,11 @@
(context "/user" []
(register-route :user
(GET "/" [id] (str "user list")))
- (context "/:id" []
+ (context "/:id" [id]
(register-route :user
- (GET "/" [id] (str "user " id)))
+ (GET "/" [] (str "user " id)))
(register-route :edit-user
- (GET "/edit" [id] (str "edit user " id)))))
+ (GET "/edit" [] (str "edit user " id)))))
(GET "/succeed1" [] (url-for :user))
(GET "/succeed2" [] (url-for :user 10))
(GET "/succeed3" [] (url-for :edit-user 10))