summary refs log tree commit homepage
path: root/t/write-on-close.ru
blob: 54a2f2e2cb131eb4af55f04df2aade285dbb6868 (plain)
1
2
3
4
5
6
7
8
9
10
11
class WriteOnClose
  def each(&block)
    @callback = block
  end

  def close
    @callback.call "7\r\nGoodbye\r\n0\r\n\r\n"
  end
end
use Rack::ContentType, "text/plain"
run(lambda { |_| [ 200, [%w(Transfer-Encoding chunked)], WriteOnClose.new ] })