Permalink
Browse files

Added options to handler/site function

  • Loading branch information...
1 parent 1396518 commit 43e0c0cac519b2269abe22b9756f54d3b97f58e9 @weavejester committed Dec 29, 2010
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/compojure/handler.clj
View
12 src/compojure/handler.clj
@@ -6,6 +6,12 @@
cookies
session]))
+(defn- with-opts
+ [routes middleware opts]
+ (if opts
+ (middleware routes opts)
+ (middleware routes)))
+
(defn api
"Create a handler suitable for a web API."
[routes]
@@ -16,7 +22,7 @@
(defn site
"Create a handler suitable for a standard website."
- [routes]
+ [routes & [opts]]
(-> (api routes)
- wrap-multipart-params
- wrap-session))
+ (wrap-multipart-params)
+ (with-opts wrap-session (:session opts))))

0 comments on commit 43e0c0c

Please sign in to comment.