summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--lib/rack/methodoverride.rb1
-rw-r--r--test/spec_methodoverride.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/rack/methodoverride.rb b/lib/rack/methodoverride.rb
index 7d2b56eb..c0963c1a 100644
--- a/lib/rack/methodoverride.rb
+++ b/lib/rack/methodoverride.rb
@@ -37,6 +37,7 @@ module Rack
 
     def method_override_param(req)
       req.POST[METHOD_OVERRIDE_PARAM_KEY]
+    rescue Utils::InvalidParameterError, Utils::ParameterTypeError
     end
   end
 end
diff --git a/test/spec_methodoverride.rb b/test/spec_methodoverride.rb
index 16f5f283..c62fcdc5 100644
--- a/test/spec_methodoverride.rb
+++ b/test/spec_methodoverride.rb
@@ -72,4 +72,11 @@ EOF
 
     env["REQUEST_METHOD"].should.equal "POST"
   end
+
+  should "not modify REQUEST_METHOD for POST requests when the params are unparseable" do
+    env = Rack::MockRequest.env_for("/", :method => "POST", :input => "(%bad-params%)")
+    app.call env
+
+    env["REQUEST_METHOD"].should.equal "POST"
+  end
 end