class Rack::MediaType
def params(content_type)
and "text/plain;charset" will return { 'charset' => '' }, similarly to
lack a value (e.g., "text/plain;charset=" will return { 'charset' => '' },
This will pass back parameters with empty strings in the hash if they
{ 'charset' => 'utf-8' }
this method responds with the following Hash:
provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8",
an empty Hash if no CONTENT_TYPE or media-type parameters were
The media type parameters provided in CONTENT_TYPE as a Hash, or
def params(content_type) return {} if content_type.nil? content_type.split(SPLIT_PATTERN)[1..-1].each_with_object({}) do |s, hsh| s.strip! k, v = s.split('=', 2) k.downcase! hsh[k] = strip_doublequotes(v) end end