aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRyan Tomayko <r@tomayko.com>2015-03-23 08:11:14 -0400
committerAndrew White <andyw@pixeltrix.co.uk>2015-03-23 13:15:59 +0000
commit0b81b3094a1176659664e52715f9621e431fabd0 (patch)
tree86f27f0c62f2be07f975fde94efe8e9bfb9bb152 /actionpack/lib
parentf768cb07e6d7e2c7479c0a91d69ca88ae3e41ad1 (diff)
downloadrails-0b81b3094a1176659664e52715f9621e431fabd0.tar.gz
rails-0b81b3094a1176659664e52715f9621e431fabd0.tar.bz2
rails-0b81b3094a1176659664e52715f9621e431fabd0.zip
Fix ActionDispatch::PublicExceptions returning string rack status
The status returned in the rack [status, headers, body] array was a string, which can cause problems with middleware that assumes the status will be a Fixnum. This likely never surfaced because other middleware to_i the status returned from downstream apps before passing it on.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/middleware/public_exceptions.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/public_exceptions.rb b/actionpack/lib/action_dispatch/middleware/public_exceptions.rb
index 040cb215b7..7cde76b30e 100644
--- a/actionpack/lib/action_dispatch/middleware/public_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/public_exceptions.rb
@@ -17,10 +17,10 @@ module ActionDispatch
end
def call(env)
- status = env["PATH_INFO"][1..-1]
+ status = env["PATH_INFO"][1..-1].to_i
request = ActionDispatch::Request.new(env)
content_type = request.formats.first
- body = { :status => status, :error => Rack::Utils::HTTP_STATUS_CODES.fetch(status.to_i, Rack::Utils::HTTP_STATUS_CODES[500]) }
+ body = { :status => status, :error => Rack::Utils::HTTP_STATUS_CODES.fetch(status, Rack::Utils::HTTP_STATUS_CODES[500]) }
render(status, content_type, body)
end