Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix complex pre-route url issue

Signed-off-by: Chris Granger <ibdknox@gmail.com>
  • Loading branch information...
commit 3133daa8d401ade310bf8c1e0843a3bad198e8c5 1 parent 1b04e62
Chris Granger ibdknox authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/noir/core.clj
7 src/noir/core.clj
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.