class Sinatra::Base

def provides(*types)

Condition for matching mimetypes. Accepts file extensions.
def provides(*types)
  types.map! { |t| mime_types(t) }
  types.flatten!
  condition do
    if type = response['Content-Type']
      types.include? type or types.include? type[/^[^;]+/]
    elsif type = request.preferred_type(types)
      params = (type.respond_to?(:params) ? type.params : {})
      content_type(type, params)
      true
    else
      false
    end
  end
end