From 7fa61b1550afab242353e5a093854f88569c4db7 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Thu, 13 Jul 2017 14:24:13 +0900 Subject: Use `#set_content_type` instead of `#set_header` By this commit, `#set_header` is called only via `#set_content_type`. This commit makes the role of `#charset=` more clear. --- actionpack/lib/action_dispatch/http/response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/http') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index eab663e2e0..9b510d4ab9 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -259,7 +259,7 @@ module ActionDispatch # :nodoc: def charset=(charset) header_info = parsed_content_type_header if false == charset - set_header CONTENT_TYPE, header_info.mime_type + set_content_type header_info.mime_type, nil else content_type = header_info.mime_type set_content_type content_type, charset || self.class.default_charset -- cgit v1.2.3 From c46dbb355b2b2218e4b0b2bcf1898e6d50f3a907 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Thu, 13 Jul 2017 14:28:21 +0900 Subject: Brush up local variables assignment --- actionpack/lib/action_dispatch/http/response.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/http') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 9b510d4ab9..d84f4701c6 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -257,11 +257,10 @@ module ActionDispatch # :nodoc: # response.charset = 'utf-16' # => 'utf-16' # response.charset = nil # => 'utf-8' def charset=(charset) - header_info = parsed_content_type_header + content_type = parsed_content_type_header.mime_type if false == charset - set_content_type header_info.mime_type, nil + set_content_type content_type, nil else - content_type = header_info.mime_type set_content_type content_type, charset || self.class.default_charset end end -- cgit v1.2.3