class Sinatra::Request

rubydoc.info/github/rack/rack/master/Rack/Request<br>The request object. See Rack::Request for more info:

def accept

Returns an array of acceptable media types for the response
def accept
  @env['sinatra.accept'] ||= begin
    if @env.include? 'HTTP_ACCEPT' and @env['HTTP_ACCEPT'].to_s != ''
      @env['HTTP_ACCEPT'].to_s.scan(HEADER_VALUE_WITH_PARAMS).
        map! { |e| AcceptEntry.new(e) }.sort
    else
      [AcceptEntry.new('*/*')]
    end
  end
end

def accept?(type)

def accept?(type)
  preferred_type(type).to_s.include?(type)
end

def forwarded?

def forwarded?
  @env.include? "HTTP_X_FORWARDED_HOST"
end

def idempotent?

def idempotent?
  safe? or put? or delete? or link? or unlink?
end

def link?

def link?
  request_method == "LINK"
end

def params

def params
  super
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
  raise BadRequest, "Invalid query parameters: #{e.message}"
end

def preferred_type(*types)

def preferred_type(*types)
  accepts = accept # just evaluate once
  return accepts.first if types.empty?
  types.flatten!
  return types.first if accepts.empty?
  accepts.detect do |pattern|
    type = types.detect { |t| File.fnmatch(pattern, t) }
    return type if type
  end
end

def safe?

def safe?
  get? or head? or options? or trace?
end

def unlink?

def unlink?
  request_method == "UNLINK"
end