diff options
Diffstat (limited to 'test/webrick/test_httpresponse.rb')
-rw-r--r-- | test/webrick/test_httpresponse.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/webrick/test_httpresponse.rb b/test/webrick/test_httpresponse.rb index 3a98a53b71..6263e0a710 100644 --- a/test/webrick/test_httpresponse.rb +++ b/test/webrick/test_httpresponse.rb @@ -169,6 +169,29 @@ module WEBrick assert_equal 0, logger.messages.length end + def test_send_body_proc + @res.body = Proc.new { |out| out.write('hello') } + IO.pipe do |r, w| + @res.send_body(w) + w.close + r.binmode + assert_equal 'hello', r.read + end + assert_equal 0, logger.messages.length + end + + def test_send_body_proc_chunked + @res.body = Proc.new { |out| out.write('hello') } + @res.chunked = true + IO.pipe do |r, w| + @res.send_body(w) + w.close + r.binmode + assert_equal "5\r\nhello\r\n0\r\n\r\n", r.read + end + assert_equal 0, logger.messages.length + end + def test_set_error status = 400 message = 'missing attribute' |