diff options
author | Matthew Draper <matthew@trebex.net> | 2015-06-13 07:26:13 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-06-13 07:31:23 +0930 |
commit | ffea1210daf1268867c14836bf060a76cd70c6ca (patch) | |
tree | 9cebf70c94b6b366b41735c91288236e1f047cac | |
parent | b83c497b38dd6a54d6f79e978f4b38253f11d3e1 (diff) | |
download | rack-ffea1210daf1268867c14836bf060a76cd70c6ca.tar.gz |
Merge pull request #835 from greysteil/handle-param-parsing-errors-in-method-override
Ignore param parsing errors in MethodOverride
-rw-r--r-- | lib/rack/methodoverride.rb | 1 | ||||
-rw-r--r-- | test/spec_methodoverride.rb | 7 |
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 |