lib/goliath/rack/default_response_format.rb in goliath-1.0.5 vs lib/goliath/rack/default_response_format.rb in goliath-1.0.6

- old
+ new

@@ -2,20 +2,14 @@ module Rack class DefaultResponseFormat include Goliath::Rack::AsyncMiddleware def post_process(env, status, headers, body) - return [status, headers, body] if body.respond_to?(:to_ary) - - new_body = [] - if body.respond_to?(:each) - body.each { |chunk| new_body << chunk } + if body.is_a?(String) + [status, headers, [body]] else - new_body << body + [status, headers, body] end - new_body.collect! { |item| item.to_s } - - [status, headers, new_body.flatten] end end end end