Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

made _method parameter case-insensitive

  • Loading branch information...
commit 9f7c836c81e1ebfa0c50030f5b34a07a6c704aed 1 parent c6f7cfd
Rhodri Pugh rodnaph authored
Showing with 9 additions and 1 deletion.
  1. +2 −1  src/compojure/core.clj
  2. +7 −0 test/compojure/test/core.clj
3  src/compojure/core.clj
View
@@ -12,7 +12,8 @@
(let [request-method (request :request-method)
form-method (get-in request [:form-params "_method"])]
(if (and form-method (= request-method :post))
- (= (str/upper-case (name method)) form-method)
+ (= (str/upper-case (name method))
+ (str/upper-case form-method))
(= method request-method))))
(defn- if-method
7 test/compojure/test/core.clj
View
@@ -57,6 +57,13 @@
route (PUT "/foo" [] resp)]
(is (= (route req) resp))))
+ (testing "_method parameter case-insenstive"
+ (let [req (-> (request :post "/foo")
+ (assoc :form-params {"_method" "delete"}))
+ resp {:status 200, :headers {}, :body "bar"}
+ route (DELETE "/foo" [] resp)]
+ (is (= (route req) resp))))
+
(testing "HEAD requests"
(let [resp {:status 200, :headers {"X-Foo" "foo"}, :body "bar"}
route (GET "/foo" [] resp)]
Please sign in to comment.
Something went wrong with that request. Please try again.