def parse_media_type(media_type)
      m = media_type.to_s.match(/^\s*([a-zA-Z*]+)\s*\/\s*([a-zA-Z0-9*\-.+]+)\s*(?:;(.+))?$/)
      m ? [m[1].downcase, m[2].downcase, m[3] || ''] : []
    end
def parse_media_type(media_type)
      m = media_type.to_s.match(/^\s*([a-zA-Z*]+)\s*\/\s*([a-zA-Z0-9*\-.+]+)\s*(?:;(.+))?$/)
      m ? [m[1].downcase, m[2].downcase, m[3] || ''] : []
    end
Parses a media type string into its relevant pieces. The return value
 will be an array with three values: 1) the content type, 2) the content
 subtype, and 3) the media type parameters. An empty array is returned if
 no match can be made.