aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-08-02 19:09:34 +0930
committerGitHub <noreply@github.com>2017-08-02 19:09:34 +0930
commit8e321714588867c3f869479d09c01817ed73b7ec (patch)
tree9d5da24875db06eb610a2ac5b8d0f151fc8aa3c2 /actionpack
parentac6cd6800a1eb7dc86ff3897cca7434af636ea48 (diff)
parentc46dbb355b2b2218e4b0b2bcf1898e6d50f3a907 (diff)
downloadrails-8e321714588867c3f869479d09c01817ed73b7ec.tar.gz
rails-8e321714588867c3f869479d09c01817ed73b7ec.tar.bz2
rails-8e321714588867c3f869479d09c01817ed73b7ec.zip
Merge pull request #29777 from yui-knk/set_content_type
Refactoring `Response#charset=`
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 84b2ef253d..b314dbecfe 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -259,11 +259,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_header CONTENT_TYPE, header_info.mime_type
+ 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