diff options
Diffstat (limited to 'lib/rack/showexceptions.rb')
-rw-r--r-- | lib/rack/showexceptions.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/rack/showexceptions.rb b/lib/rack/showexceptions.rb index 39499d5e..0e8a5952 100644 --- a/lib/rack/showexceptions.rb +++ b/lib/rack/showexceptions.rb @@ -17,7 +17,6 @@ module Rack def initialize(app) @app = app - @template = ERB.new(TEMPLATE) end def call(env) @@ -33,15 +32,21 @@ module Rack body = pretty(env, e) else content_type = "text/plain" - body = [exception_string] + body = exception_string end - [500, - {"Content-Type" => content_type, - "Content-Length" => Rack::Utils.bytesize(body.join).to_s}, - body] + [ + 500, + { + "Content-Type" => content_type, + "Content-Length" => Rack::Utils.bytesize(body).to_s, + }, + [body], + ] end + private + def accepts_html?(env) env["HTTP_ACCEPT"] && env["HTTP_ACCEPT"].include?("text/html") end @@ -85,7 +90,7 @@ module Rack end }.compact - [@template.result(binding)] + ERB.new(TEMPLATE).result(binding) end def h(obj) # :nodoc: |