module ActionDispatch::Http::MimeNegotiation

def formats

def formats
  fetch_header("action_dispatch.request.formats") do |k|
    v = if params_readable?
      Array(Mime[parameters[:format]])
    elsif use_accept_header && valid_accept_header
      accepts.dup
    elsif extension_format = format_from_path_extension
      [extension_format]
    elsif xhr?
      [Mime[:js]]
    else
      [Mime[:html]]
    end
    v.select! do |format|
      format.symbol || format.ref == "*/*"
    end
    set_header k, v
  end
end