diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-12 21:47:34 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-12 21:47:34 -0700 |
commit | 91d274059536f09dffd87141e570c3eab9ebd9b4 (patch) | |
tree | 92fa61084a96f9b53b5248544c9ce12bfbf1f5dd /actionpack/lib/action_controller/integration.rb | |
parent | c8c2b3820e662a2f9dfbfdae7211625adfabf15f (diff) | |
download | rails-91d274059536f09dffd87141e570c3eab9ebd9b4.tar.gz rails-91d274059536f09dffd87141e570c3eab9ebd9b4.tar.bz2 rails-91d274059536f09dffd87141e570c3eab9ebd9b4.zip |
Return body parts directly to Rack rather than building a response string ourselves. Allows Rack middleware to orchestrate response building.
Diffstat (limited to 'actionpack/lib/action_controller/integration.rb')
-rw-r--r-- | actionpack/lib/action_controller/integration.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 1c05ab0bf6..4faa263e2d 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -332,11 +332,13 @@ module ActionController @cookies[name] = value end - @body = "" if body.is_a?(String) - @body << body + @body_parts = [body] + @body = body else - body.each { |part| @body << part } + @body_parts = [] + body.each { |part| @body_parts << part.to_s } + @body = @body_parts.join end if @controller = ActionController::Base.last_instantiation @@ -349,7 +351,7 @@ module ActionController @response = Response.new @response.status = status.to_s @response.headers.replace(@headers) - @response.body = @body + @response.body = @body_parts end # Decorate the response with the standard behavior of the |