summary refs log tree commit homepage
path: root/t/sleep.ru
blob: b57efc35c33c5c8f5e91f3e911e5f69df4acf3d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use Rack::ContentLength

run lambda { |env|
  /\A100-continue\z/i =~ env['HTTP_EXPECT'] and return [ 100, {}, [] ]

  env['rack.input'].read
  nr = 1
  env["PATH_INFO"] =~ %r{/([\d\.]+)\z} and nr = $1.to_f

  Rainbows.sleep(nr)

  [ 200, {'Content-Type' => 'text/plain'}, [ "Hello\n" ] ]
}