Skip to content

Commit

Permalink
add test for WEBrick partial hijack
Browse files Browse the repository at this point in the history
  • Loading branch information
dahakawang committed Mar 29, 2013
1 parent c5621e9 commit 146614c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/spec_webrick.rb
Expand Up @@ -139,5 +139,28 @@
} }
end end


should "support Rack partial hijack" do
io_lambda = lambda{ |io|
5.times do
io.write "David\r\n"
end
io.close
}

@server.mount "/partial", Rack::Handler::WEBrick,
Rack::Lint.new(lambda{ |req|
[
200,
{"rack.hijack" => io_lambda},
[""]
]
})

Net::HTTP.start(@host, @port){ |http|
res = http.get("/partial")
res.body.should.equal "David\r\nDavid\r\nDavid\r\nDavid\r\nDavid\r\n"
}
end

@server.shutdown @server.shutdown
end end

0 comments on commit 146614c

Please sign in to comment.