aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-09-08 16:00:10 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-09-08 16:14:47 -0700
commitc10efc838698a4d3c99feba9ea85d1f42062e36a (patch)
treec8f6c041df72f0de262f59f7339b1dba1baaf9da
parent376cccbdc1a39644dce234c39086349d81d907e7 (diff)
downloadrails-c10efc838698a4d3c99feba9ea85d1f42062e36a.tar.gz
rails-c10efc838698a4d3c99feba9ea85d1f42062e36a.tar.bz2
rails-c10efc838698a4d3c99feba9ea85d1f42062e36a.zip
remove `parse_content_type` parameter
This method is specifically about the content type so lets remove the parameter.
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 71e7ebb838..a370c3f082 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -174,7 +174,7 @@ module ActionDispatch # :nodoc:
# Sets the HTTP content type.
def content_type=(content_type)
- header_info = parse_content_type(get_header(CONTENT_TYPE))
+ header_info = parse_content_type
set_content_type content_type.to_s, header_info.charset || self.class.default_charset
end
@@ -188,7 +188,7 @@ module ActionDispatch # :nodoc:
# information.
def content_type
- type = parse_content_type(get_header(CONTENT_TYPE)).mime_type
+ type = parse_content_type.mime_type
type && type.to_s
end
@@ -204,7 +204,7 @@ module ActionDispatch # :nodoc:
# response.charset = 'utf-16' # => 'utf-16'
# response.charset = nil # => 'utf-8'
def charset=(charset)
- header_info = parse_content_type(get_header(CONTENT_TYPE))
+ header_info = parse_content_type
if false == charset
set_header CONTENT_TYPE, header_info.mime_type
else
@@ -216,7 +216,7 @@ module ActionDispatch # :nodoc:
# The charset of the response. HTML wants to know the encoding of the
# content you're giving them, so we need to send that along.
def charset
- header_info = parse_content_type(get_header(CONTENT_TYPE))
+ header_info = parse_content_type
header_info.charset || self.class.default_charset
end
@@ -320,7 +320,8 @@ module ActionDispatch # :nodoc:
ContentTypeHeader = Struct.new :mime_type, :charset
NullContentTypeHeader = ContentTypeHeader.new nil, nil
- def parse_content_type(content_type)
+ def parse_content_type
+ content_type = get_header CONTENT_TYPE
if content_type
type, charset = content_type.split(/;\s*charset=/)
type = nil if type.empty?
@@ -360,7 +361,7 @@ module ActionDispatch # :nodoc:
def assign_default_content_type_and_charset!
return if content_type
- ct = parse_content_type get_header(CONTENT_TYPE)
+ ct = parse_content_type
set_content_type(ct.mime_type || Mime::HTML.to_s,
ct.charset || self.class.default_charset)
end