Browse files

fix complex pre-route url issue

Signed-off-by: Chris Granger <>
  • Loading branch information...
1 parent 1b04e62 commit 3133daa8d401ade310bf8c1e0843a3bad198e8c5 @ibdknox ibdknox committed Oct 7, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/noir/core.clj
@@ -142,8 +142,11 @@
(pre-route '/admin/*' {} (when-not (is-admin?) (redirect '/login')))"
[& args]
- (let [{:keys [action destruct url body]} (parse-args args)]
- `(swap! pre-routes assoc ~url (~action ~url {:as request#} ((fn [~destruct] ~@body) request#)))))
+ (let [{:keys [action destruct url body]} (parse-args args)
+ safe-url (if (vector? url)
+ (first url)
+ url)]
+ `(swap! pre-routes assoc ~safe-url (~action ~url {:as request#} ((fn [~destruct] ~@body) request#)))))
(defmacro post-route
"Adds a route to the end of the route table and passes the entire request to

0 comments on commit 3133daa

Please sign in to comment.