Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

render_for_text pushes a body part instead of replacing the whole body

  • Loading branch information...
commit a22a778f860032b9d6bf3a8b19d0b22fc174550c 1 parent 1414e2a
@jeremy jeremy authored
View
21 actionpack/lib/action_controller/base/responder.rb
@@ -5,18 +5,19 @@ def self.included(klass)
end
private
- def render_for_text(text = nil, append_response = false) #:nodoc:
+ def render_for_text(text) #:nodoc:
@performed_render = true
- if append_response
- response.body ||= ''
- response.body << text.to_s
- else
- response.body = case text
- when Proc then text
- when nil then " " # Safari doesn't pass the headers of the return if the response is zero length
- else text.to_s
+ case text
+ when Proc
+ response.body = text
+ when nil
+ # Safari 2 doesn't pass response headers if the response is zero-length
+ if response.body_parts.empty?
+ response.body_parts << ' '
end
+ else
+ response.body_parts << text
end
end
@@ -39,4 +40,4 @@ def action_methods
end
end
end
-end
+end
View
1  actionpack/lib/action_controller/testing/process.rb
@@ -287,6 +287,7 @@ class TestResponse < ActionDispatch::Response
include TestResponseBehavior
def recycle!
+ body_parts.clear
headers.delete('ETag')
headers.delete('Last-Modified')
end
Please sign in to comment.
Something went wrong with that request. Please try again.