diff options
author | printercu <melentievm@gmail.com> | 2018-09-14 19:04:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-14 19:04:12 +0300 |
commit | 4a4bd927abff30a1acf31b34c6fad5e0aa33696c (patch) | |
tree | b2fbbf0d5ae0d5ce8714e295612a50413bf16a05 | |
parent | d3c73ae5e4ebabdf6c79e490fddb2cbfb0de3b76 (diff) | |
download | rails-4a4bd927abff30a1acf31b34c6fad5e0aa33696c.tar.gz rails-4a4bd927abff30a1acf31b34c6fad5e0aa33696c.tar.bz2 rails-4a4bd927abff30a1acf31b34c6fad5e0aa33696c.zip |
[ci skip] Fix documentation for Response#content_type
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 7e50cb6d23..885dc0ecba 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -224,16 +224,6 @@ module ActionDispatch # :nodoc: @status = Rack::Utils.status_code(status) end - # Sets the HTTP content type. - def content_type=(content_type) - return unless content_type - new_header_info = parse_content_type(content_type.to_s) - prev_header_info = parsed_content_type_header - charset = new_header_info.charset || prev_header_info.charset - charset ||= self.class.default_charset unless prev_header_info.mime_type - set_content_type new_header_info.mime_type, charset - end - # Sets the HTTP response's content MIME type. For example, in the controller # you could write this: # @@ -242,7 +232,17 @@ module ActionDispatch # :nodoc: # If a character set has been defined for this response (see charset=) then # the character set information will also be included in the content type # information. + def content_type=(content_type) + return unless content_type + new_header_info = parse_content_type(content_type.to_s) + prev_header_info = parsed_content_type_header + charset = new_header_info.charset || prev_header_info.charset + charset ||= self.class.default_charset unless prev_header_info.mime_type + set_content_type new_header_info.mime_type, charset + end + # Content type of response. + # It returns just MIME type and does NOT contain charset part. def content_type parsed_content_type_header.mime_type end |