From bf8b22b392266550d3edd5d15d0cfc1589d7b88a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Sep 2015 15:29:18 -0700 Subject: 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. --- actionpack/lib/action_dispatch/http/response.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_dispatch') 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 -- cgit v1.2.3