Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed issue with wrap! not working for multiple middleware

Signed-off-by: weavejester <jreeves@weavejester.com>
  • Loading branch information...
commit c8a2aca9e2811becaa3c4a75392e2a46cfe72570 1 parent aca5011
@paraseba paraseba authored committed
Showing with 9 additions and 2 deletions.
  1. +2 −2 src/compojure/core.clj
  2. +7 −0 test/compojure/core_test.clj
View
4 src/compojure/core.clj
@@ -111,7 +111,7 @@
[path args & body]
(compile-route nil path args body))
-(defn- keywords->middleware
+(defn- keyword->middleware
"Turn a keyword into a wrapper function symbol.
e.g. :test => wrap-test
(:test x) => (wrap-test x)"
@@ -134,7 +134,7 @@
=> (wrap! foo (wrap-session cookie-store))
=> (def foo (wrap-session foo cookie-store))"
[handler & funcs]
- (let [funcs (keywords->middleware funcs)]
+ (let [funcs (map keyword->middleware funcs)]
`(alter-var-root
(var ~handler)
(constantly (-> ~handler ~@funcs)))))
View
7 test/compojure/core_test.clj
@@ -44,3 +44,10 @@
(deftest wrap-var-with-namespaced-keyword
(wrap! func3 :testns/test2)
(is (= (func3 3) 10)))
+
+(defn func4 [x] (inc x))
+
+(deftest wrap-var-with-function-and-keyword
+ (wrap! func4 wrap-test1 :test1)
+ (is (= (func4 3) 13)))
+
Please sign in to comment.
Something went wrong with that request. Please try again.