Merge pull request #717 from bhollis/rack

Fix Middleman::Util.extract_response_text to follow the Rack spec (and thus work with rack 1.4.3)
This commit is contained in:
Thomas Reynolds 2013-01-08 22:51:31 -08:00
commit 3521b7527b

View file

@ -66,18 +66,12 @@ module Middleman
# @param response The response from #call # @param response The response from #call
# @return [String] The whole response as a string. # @return [String] The whole response as a string.
def self.extract_response_text(response) def self.extract_response_text(response)
case(response) # The rack spec states all response bodies must respond to each
when String result = ''
response response.each do |part, s|
when Array result << part
response.join
when Rack::Response
response.body.join
when Rack::File
File.read(response.path)
else
response.to_s
end end
result
end end
# Takes a matcher, which can be a literal string # Takes a matcher, which can be a literal string