Skip to content

Commit 21b056b

Browse files
committed
system property for middleware
1 parent 32cd8b8 commit 21b056b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/compojure/api/core.clj

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
(routes/create nil nil {} nil (partial handle handlers))))
3939

4040
(defmacro middleware
41-
"Wraps routes with given middleware using thread-first macro.
41+
"Wraps routes with given middlewares using thread-first macro.
4242
4343
Note that middlewares will be executed even if routes in body
4444
do not match the request uri. Be careful with middleware that
@@ -47,6 +47,10 @@
4747
:deprecated "1.1.14"
4848
:superseded-by "route-middleware"}
4949
[middleware & body]
50+
(assert (= "true" (System/getProperty "compojure.api.core.allow-dangerous-middleware"))
51+
(str "compojure.api.core.middleware is deprecated because of security issues. "
52+
"Please use route-middleware instead. "
53+
"Set compojure.api.core.allow-dangerous-middleware=true to keep using middleware."))
5054
`(let [body# (routes ~@body)
5155
wrap-mw# (mw/compose-middleware ~middleware)]
5256
(routes/create nil nil {} [body#] (wrap-mw# body#))))

0 commit comments

Comments
 (0)