class Sinatra::Request

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