Permalink
Browse files

Merge pull request #907 from kgrz/fix-error-with-rack-master

Update ShowExceptions to suit latest rack master
  • Loading branch information...
zzak committed Aug 11, 2014
2 parents 68c237d + b39d72d commit a43ba2c65a79bf58adc1291b0079ea889310e072
Showing with 10 additions and 4 deletions.
  1. +10 −4 lib/sinatra/show_exceptions.rb
@@ -24,18 +24,24 @@ def call(env)
if prefers_plain_text?(env)
content_type = "text/plain"
body = [dump_exception(e)]
exception_string = dump_exception(e)
else
content_type = "text/html"
body = pretty(env, e)
exception_string = pretty(env, e)
end
env["rack.errors"] = errors
[500,
# Post 893a2c50 in rack/rack, the #pretty method above, implemented in
# Rack::ShowExceptions, returns a String instead of an array.
body = Array(exception_string)
[
500,
{"Content-Type" => content_type,
"Content-Length" => Rack::Utils.bytesize(body.join).to_s},
body]
body
]
end
private

0 comments on commit a43ba2c

Please sign in to comment.