From 0f2b10d43fcbd5d5661dfe9f0b3ab50b5c410967 Mon Sep 17 00:00:00 2001 From: James Reeves Date: Wed, 29 Dec 2010 11:32:32 +0000 Subject: [PATCH] Removed default middleware from routes --- src/compojure/core.clj | 12 ++---------- test/compojure/test/core.clj | 29 ++++------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/src/compojure/core.clj b/src/compojure/core.clj index 3f894cf8..7382a3ae 100644 --- a/src/compojure/core.clj +++ b/src/compojure/core.clj @@ -2,11 +2,7 @@ "A concise syntax for generating Ring handlers." (:use clojure.contrib.def clout.core - compojure.response - [ring.middleware params - keyword-params - nested-params - cookies])) + compojure.response)) (defn- method-matches "True if this request matches the supplied method." @@ -88,11 +84,7 @@ (defn routes "Create a Ring handler by combining several handlers into one." [& handlers] - (-> #(apply routing % handlers) - wrap-keyword-params - wrap-nested-params - wrap-params - wrap-cookies)) + #(apply routing % handlers)) (defmacro defroutes "Define a Ring handler function from a sequence of routes. The name may be diff --git a/test/compojure/test/core.clj b/test/compojure/test/core.clj index e6114149..55e7aaf2 100644 --- a/test/compojure/test/core.clj +++ b/test/compojure/test/core.clj @@ -63,31 +63,10 @@ (GET "/bar" [] (is true) nil))) (deftest routes-test - (testing "multiple routes" - ((routes - (GET "/foo" [] (is false) nil) - (GET "/bar" [] (is true) nil)) - (request :get "/bar"))) - - (testing "keyword parameters" - ((routes - (GET "/:x" [x y & more] - (is (= x "foo")) - (is (= y "bar")) - (is (= more {:z "baz"})) - nil)) - (request :get "/foo" {:y "bar", :z "baz"}))) - - (testing "nested parameters" - ((routes - (GET "/" [x y] - (is (= x {:a "1", :b "2"})) - (is (= y ["3" "4"])) - nil)) - (request :get "/" [["x[a]" "1"] - ["x[b]" "2"] - ["y[]" "3"] - ["y[]" "4"]])))) + ((routes + (GET "/foo" [] (is false) nil) + (GET "/bar" [] (is true) nil)) + (request :get "/bar"))) (deftest wrap (testing "wrap function"