diff options
author | Matt Clark <44023+mclark@users.noreply.github.com> | 2018-04-12 17:14:36 -0400 |
---|---|---|
committer | Matt Clark <44023+mclark@users.noreply.github.com> | 2018-04-16 13:28:39 -0400 |
commit | b27dd86738c21110cc5e8befa2fa217f81124ee3 (patch) | |
tree | a90f31e0b0f9529153a89453e8568e2c3b0df416 /lib/rack/methodoverride.rb | |
parent | 274d934f32cc08a550f9e37bfdced7e228b42196 (diff) | |
download | rack-b27dd86738c21110cc5e8befa2fa217f81124ee3.tar.gz |
handle failure to upcase invalid strings
Some strings cannot be upper cased and raise an ArgumentError instead. Let's capture this error and log its occurence to the environment via rack.errors
Diffstat (limited to 'lib/rack/methodoverride.rb')
-rw-r--r-- | lib/rack/methodoverride.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rack/methodoverride.rb b/lib/rack/methodoverride.rb index 16bf23cf..61cb27fc 100644 --- a/lib/rack/methodoverride.rb +++ b/lib/rack/methodoverride.rb @@ -26,7 +26,11 @@ module Rack req = Request.new(env) method = method_override_param(req) || env[HTTP_METHOD_OVERRIDE_HEADER] - method.to_s.upcase + begin + method.to_s.upcase + rescue ArgumentError + env["rack.errors"].puts "Invalid string for method" + end end private |