Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use Array#join so that file encoding doesn't impact returned string.

Fixes #3957
  • Loading branch information...
commit 810837dda890a5bc5d0b4d65b973ca0ccc9465bd 1 parent 3d4f913
@tenderlove tenderlove authored
View
6 actionpack/lib/action_dispatch/http/response.rb
@@ -111,9 +111,9 @@ def to_path
end
def body
- str = ''
- each { |part| str << part.to_s }
- str
+ strings = []
+ each { |part| strings << part.to_s }
+ strings.join
end
EMPTY = " "
View
9 actionpack/test/dispatch/response_test.rb
@@ -5,6 +5,15 @@ def setup
@response = ActionDispatch::Response.new
end
+ def test_response_body_encoding
+ # FIXME: remove this conditional on Rails 4.0
+ return unless "<3".encoding_aware?
+
+ body = ["hello".encode('utf-8')]
+ response = ActionDispatch::Response.new 200, {}, body
+ assert_equal Encoding::UTF_8, response.body.encoding
+ end
+
test "simple output" do
@response.body = "Hello, World!"
Please sign in to comment.
Something went wrong with that request. Please try again.