aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2011-12-07 01:46:41 +0900
committerkennyj <kennyj@gmail.com>2011-12-07 12:35:44 +0900
commita1986e7d55bed6895cab3d8b490f769d7abe727b (patch)
tree063f4ea3916c3c3a24b7ca053042af725a345857 /actionpack/test/dispatch
parent9be2353fac89729b839df3d0538b607f3fc1aa87 (diff)
downloadrails-a1986e7d55bed6895cab3d8b490f769d7abe727b.tar.gz
rails-a1986e7d55bed6895cab3d8b490f769d7abe727b.tar.bz2
rails-a1986e7d55bed6895cab3d8b490f769d7abe727b.zip
Use default charset when we read content type without charset.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/response_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 5abbaf74fe..337ece6b88 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -130,6 +130,17 @@ class ResponseTest < ActiveSupport::TestCase
assert_equal('application/xml; charset=utf-16', resp.headers['Content-Type'])
end
+
+ test "read content type without charset" do
+ original = ActionDispatch::Response.default_charset
+ begin
+ ActionDispatch::Response.default_charset = 'utf-16'
+ resp = ActionDispatch::Response.new(200, { "Content-Type" => "text/xml" })
+ assert_equal('utf-16', resp.charset)
+ ensure
+ ActionDispatch::Response.default_charset = original
+ end
+ end
end
class ResponseIntegrationTest < ActionDispatch::IntegrationTest