summaryrefslogtreecommitdiff
path: root/lib/rack/showstatus.rb
diff options
context:
space:
mode:
authorTim Fletcher <twoggle@gmail.com>2007-04-03 20:09:00 +0000
committerTim Fletcher <twoggle@gmail.com>2007-04-03 20:09:00 +0000
commit6e640a692fb7fec7b1c1a12ac4cc76e8e4172d9a (patch)
treefbb84fc737f74b5a74421e6123769445b19246e7 /lib/rack/showstatus.rb
parent234c062f746743064bc7808cf04684914a9e3e83 (diff)
downloadrack-6e640a692fb7fec7b1c1a12ac4cc76e8e4172d9a.tar.gz
Ensure Rack::ShowStatus passes on headers
darcs-hash:20070403200939-5d7f7-ef5ce0f8827f62c56b40260c75ca379a4d381b79.gz
Diffstat (limited to 'lib/rack/showstatus.rb')
-rw-r--r--lib/rack/showstatus.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/rack/showstatus.rb b/lib/rack/showstatus.rb
index a1c3a071..1b71a5e8 100644
--- a/lib/rack/showstatus.rb
+++ b/lib/rack/showstatus.rb
@@ -20,17 +20,11 @@ module Rack
status, headers, body = @app.call(env)
# client or server error, or explicit message
- if status.to_i >= 400 || env["rack.showstatus.detail"]
- empty = true
- body.each { empty = false; break }
- if empty || env["rack.showstatus.detail"]
- req = Rack::Request.new(env)
- message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s
- detail = env["rack.showstatus.detail"] || message
- [status, {"Content-Type" => "text/html"}, [@template.result(binding)]]
- else
- [status, headers, body]
- end
+ if status.to_i >= 400 && body.empty? || env["rack.showstatus.detail"]
+ req = Rack::Request.new(env)
+ message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s
+ detail = env["rack.showstatus.detail"] || message
+ [status, headers.merge("Content-Type" => "text/html"), [@template.result(binding)]]
else
[status, headers, body]
end