1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/test/rackup/sleep_step.ru

11 lines
315 B
Text
Raw Normal View History

# call with "GET /sleep<d>-<s> HTTP/1.1\r\n\r\n", where <d> is the number of
# seconds to sleep and <s> is the step
run lambda { |env|
p = env['REQUEST_PATH']
dly = (p[/\/sleep(\d+)/,1] || '0').to_i
step = p[/(\d+)\z/,1].to_i
sleep dly
[200, {"Content-Type" => "text/plain"}, ["Slept #{dly} #{step}"]]
}