summary refs log tree commit homepage
path: root/t/kgio-pipe-response.ru
blob: 9c70d474208a87b588397fdf147cb5ecb12033c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# must be run without Rack::Lint since that clobbers to_path
use Rainbows::DevFdResponse
run(lambda { |env|
  io = case env["rainbows.model"].to_s
  when /Fiber/
    Rainbows::Fiber::IO::Pipe
  else
    Kgio::Pipe
  end.popen('cat random_blob', 'rb')

  [ 200,
    {
      'Content-Length' => ::File.stat('random_blob').size.to_s,
      'Content-Type' => 'application/octet-stream',
    },
    io
  ]
})