aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_xml_test.rb
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-04-17 15:37:16 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-06-01 09:20:13 +0900
commitea5f509643d6d9c468a9b26f6c45bd4e40fd67cf (patch)
tree76458f7e7c743bdee8d979a2af83494c21f636af /actionpack/test/controller/render_xml_test.rb
parentd3e87efedb8cf9d072584bc8703841a80c07648f (diff)
downloadrails-ea5f509643d6d9c468a9b26f6c45bd4e40fd67cf.tar.gz
rails-ea5f509643d6d9c468a9b26f6c45bd4e40fd67cf.tar.bz2
rails-ea5f509643d6d9c468a9b26f6c45bd4e40fd67cf.zip
Change `ActionDispatch::Response#content_type` returning Content-Type header as it is
Since #35709, `Response#conten_type` returns only MIME type correctly. It is a documented behavior that this method only returns MIME type, so this change seems appropriate. https://github.com/rails/rails/blob/39de7fac0507070e3c5f8b33fbad6fced84d97ed/actionpack/lib/action_dispatch/http/response.rb#L245-L249 But unfortunately, some users expect this method to return all Content-Type that does not contain charset. This seems to be breaking changes. We can change this behavior with the deprecate cycle. But, in that case, a method needs that include Content-Type with additional parameters. And that method name is probably the `content_type` seems to properly. So I changed the new behavior to more appropriate `media_type` method. And `Response#content_type` changed (as the method name) to return Content-Type header as it is. Fixes #35709. [Rafael Mendonça França & Yuuji Yaginuma ]
Diffstat (limited to 'actionpack/test/controller/render_xml_test.rb')
-rw-r--r--actionpack/test/controller/render_xml_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/test/controller/render_xml_test.rb b/actionpack/test/controller/render_xml_test.rb
index a72d14e4bb..7d61076e7c 100644
--- a/actionpack/test/controller/render_xml_test.rb
+++ b/actionpack/test/controller/render_xml_test.rb
@@ -92,11 +92,11 @@ class RenderXmlTest < ActionController::TestCase
def test_should_render_xml_but_keep_custom_content_type
get :render_xml_with_custom_content_type
- assert_equal "application/atomsvc+xml", @response.content_type
+ assert_equal "application/atomsvc+xml", @response.media_type
end
def test_should_use_implicit_content_type
get :implicit_content_type, format: "atom"
- assert_equal Mime[:atom], @response.content_type
+ assert_equal Mime[:atom], @response.media_type
end
end