diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-08 15:29:18 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-08 16:14:47 -0700 |
commit | bf8b22b392266550d3edd5d15d0cfc1589d7b88a (patch) | |
tree | 5bc0ebf41b721c852cf467c0063cdd93297c7a81 /actionpack | |
parent | 31b3294d490cc558ccbc562fbaf9695217fc234f (diff) | |
download | rails-bf8b22b392266550d3edd5d15d0cfc1589d7b88a.tar.gz rails-bf8b22b392266550d3edd5d15d0cfc1589d7b88a.tar.bz2 rails-bf8b22b392266550d3edd5d15d0cfc1589d7b88a.zip |
remove mime type lookups when parsing the content type
It turns out that the response object never really cares what the mime
type object is, so just use the string.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 03d1c94649..d6b6ef2cff 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -206,10 +206,10 @@ module ActionDispatch # :nodoc: def charset=(charset) header_info = parse_content_type(get_header(CONTENT_TYPE)) if false == charset - set_header CONTENT_TYPE, header_info.mime_type.to_s + set_header CONTENT_TYPE, header_info.mime_type else - content_type = header_info.mime_type || Mime::TEXT - set_content_type content_type.to_s, charset || self.class.default_charset + content_type = header_info.mime_type || Mime::TEXT.to_s + set_content_type content_type, charset || self.class.default_charset end end @@ -322,14 +322,14 @@ module ActionDispatch # :nodoc: def parse_content_type(content_type) if content_type type, charset = content_type.split(/;\s*charset=/) - ContentTypeHeader.new(Mime::Type.lookup(type), charset) + ContentTypeHeader.new(type, charset) else ContentTypeHeader.new(nil, nil) end end def set_content_type(content_type, charset) - type = content_type.to_s.dup + type = content_type.dup type << "; charset=#{charset}" if charset set_header CONTENT_TYPE, type end |