module Sprockets::Resolve
def parse_accept_options(mime_type, explicit_type)
[["*/*", 1.0]]
[["application/javascript", 1.0]]
Returns Array of Array
that matches the given explicit_type will be accepted.
When called with an explicit_type and a mime_type, only a mime_type
- explicit_type - String, optional. e.g. "application/javascript"
- mime_type - String, optional. e.g. "text/html"
Internal: Converts mimetype into accept Array
def parse_accept_options(mime_type, explicit_type) if mime_type return [[mime_type, 1.0]] if explicit_type.nil? return [[mime_type, 1.0]] if HTTPUtils.parse_q_values(explicit_type).any? { |accept, _| HTTPUtils.match_mime_type?(mime_type, accept) } return [] end accepts = HTTPUtils.parse_q_values(explicit_type) accepts << ['*/*'.freeze, 1.0] if accepts.empty? return accepts end