instance method
parse_content_type
Ruby on Rails edge
Since v5.0.7.2 Private — implementation detail, not part of the public APISignature
parse_content_type(content_type)
No documentation comment.
Parameters
-
content_typereq
Source
# File actionpack/lib/action_dispatch/http/response.rb, line 494
def parse_content_type(content_type)
# Without parameters or whitespace, the whole value is the media type, which
# is what CONTENT_TYPE_PARSER would return.
if String === content_type && !content_type.empty? && !content_type.match?(/[;\s]/)
ContentTypeHeader.new(String.new(content_type), nil)
elsif content_type && match = CONTENT_TYPE_PARSER.match(content_type)
ContentTypeHeader.new(match[:mime_type], match[:charset])
else
NullContentTypeHeader
end
end
Defined in actionpack/lib/action_dispatch/http/response.rb line 494
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Response