Class: RateLimitMockServer::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/rate_limit_mock_server/server.rb

Constant Summary collapse

DEFAULT_RPS_LIMIT =
4

Instance Method Summary collapse

Instance Method Details

#counterObject



39
40
41
# File 'lib/rate_limit_mock_server/server.rb', line 39

def counter
  Counter.for(request.path_info, rps_limit)
end

#rps_limitObject



35
36
37
# File 'lib/rate_limit_mock_server/server.rb', line 35

def rps_limit
  params['captures']&.first&.to_i || DEFAULT_RPS_LIMIT
end

#user_agentObject



43
44
45
# File 'lib/rate_limit_mock_server/server.rb', line 43

def user_agent
  request.env['HTTP_USER_AGENT']
end