提交 d87427c6 编写于 作者: G Gaurav Sharma

adding test for content type with default charset

* first test is for `default_charset` i.e `ActionDispatch::Response.default_charset = “utf-8”`

* In below test we are passing `ActionDispatch::Response.default_charset = 'utf-16’` so name of the test is irrelevant — “read content type without charset”
上级 62c82f7d
......@@ -196,7 +196,17 @@ def test_only_set_charset_still_defaults_to_text_html
assert_equal('application/xml; charset=utf-16', resp.headers['Content-Type'])
end
test "read content type without charset" do
test "read content type with default charset utf-8" do
original = ActionDispatch::Response.default_charset
begin
resp = ActionDispatch::Response.new(200, { "Content-Type" => "text/xml" })
assert_equal('utf-8', resp.charset)
ensure
ActionDispatch::Response.default_charset = original
end
end
test "read content type with charset utf-16" do
jruby_skip "https://github.com/jruby/jruby/issues/3138"
original = ActionDispatch::Response.default_charset
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册