module ActionDispatch::Http::MimeNegotiation

def negotiate_mime(order)


matches the order array.
Receives an array of mimes and return the first user sent mime that
def negotiate_mime(order)
  formats.each do |priority|
    if priority == Mime::ALL
      return order.first
    elsif order.include?(priority)
      return priority
    end
  end
  order.include?(Mime::ALL) ? format : nil
end