rack expects an array instead of a string, fixes #3499
This commit is contained in:
parent
8674f5aea2
commit
fd27137662
1 changed files with 5 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ module Rack
|
||||||
status, headers, response = @app.call(env)
|
status, headers, response = @app.call(env)
|
||||||
new_body = insert_tag(build_response_body(response))
|
new_body = insert_tag(build_response_body(response))
|
||||||
new_headers = recalculate_body_length(headers, new_body)
|
new_headers = recalculate_body_length(headers, new_body)
|
||||||
return [status, new_headers, new_body]
|
return [status, new_headers, [new_body]]
|
||||||
elsif @options[:minimum].nil? or ie_version(env['HTTP_USER_AGENT']) < @options[:minimum]
|
elsif @options[:minimum].nil? or ie_version(env['HTTP_USER_AGENT']) < @options[:minimum]
|
||||||
html = <<-HTML
|
html = <<-HTML
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
|
@ -42,6 +42,10 @@ module Rack
|
||||||
def build_response_body(response)
|
def build_response_body(response)
|
||||||
response_body = ""
|
response_body = ""
|
||||||
response.each { |part| response_body += part }
|
response.each { |part| response_body += part }
|
||||||
|
|
||||||
|
# see: http://johnbintz.github.com/blog/2012/03/05/closing-given-body-in-rack-middleware/
|
||||||
|
response.close if response.respond_to?(:close)
|
||||||
|
|
||||||
response_body
|
response_body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue