diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-10 17:30:35 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-10 17:30:35 +0900 |
commit | 08a93efab6bdf10ba7afafb6e51f4b7809c97ebc (patch) | |
tree | 50c52dce801175ae192669e2ee99a1037f7ba620 /actionpack/test | |
parent | 0fc13977841d0fb5aa78d5bd86fa9a540477009f (diff) | |
parent | 29b42f5e5c80e4397cd02b556f28265ac3e62966 (diff) | |
download | rails-08a93efab6bdf10ba7afafb6e51f4b7809c97ebc.tar.gz rails-08a93efab6bdf10ba7afafb6e51f4b7809c97ebc.tar.bz2 rails-08a93efab6bdf10ba7afafb6e51f4b7809c97ebc.zip |
Merge pull request #35549 from r7kamura/feature/response-charset
Support other optional parameters and quoted-strings on Content-Type parser
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/response_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index 60817c1c4d..7758b0406a 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -539,4 +539,38 @@ class ResponseIntegrationTest < ActionDispatch::IntegrationTest assert_equal('"202cb962ac59075b964b07152d234b70"', @response.headers["ETag"]) assert_equal('"202cb962ac59075b964b07152d234b70"', @response.etag) end + + test "response Content-Type with optional parameters" do + @app = lambda { |env| + [ + 200, + { "Content-Type" => "text/csv; charset=utf-16; header=present" }, + ["Hello"] + ] + } + + get "/" + assert_response :success + + assert_equal("text/csv; charset=utf-16; header=present", @response.headers["Content-Type"]) + assert_equal("text/csv", @response.content_type) + assert_equal("utf-16", @response.charset) + end + + test "response Content-Type with quoted-string" do + @app = lambda { |env| + [ + 200, + { "Content-Type" => 'text/csv; header=present; charset="utf-16"' }, + ["Hello"] + ] + } + + get "/" + assert_response :success + + assert_equal('text/csv; header=present; charset="utf-16"', @response.headers["Content-Type"]) + assert_equal("text/csv", @response.content_type) + assert_equal("utf-16", @response.charset) + end end |