test/test_response.rb in kcar-0.3.1 vs test/test_response.rb in kcar-0.4.0
- old
+ new
@@ -26,10 +26,11 @@
assert_equal({}, headers)
tmp = []
assert_nothing_raised { body.each { |chunk| tmp << chunk.dup } }
assert_equal [], tmp
assert @response.parser.keepalive?
+ assert @response.parser.body_eof?
body.close
status, headers, body = @response.rack
assert_equal status, "404 Not Found"
assert_equal({},headers)
@@ -133,10 +134,12 @@
assert_equal status, "200 OK"
assert_equal({"Content-Length" => "2" }, headers)
tmp = []
assert body.parser.keepalive?
assert_nothing_raised { body.each { |chunk| tmp << chunk.dup } }
+ assert body.parser.body_eof?
+ assert body.parser.keepalive?
assert_equal [ "HI" ], tmp
_, status = Process.waitpid2(pid)
assert status.success?
body.close
assert ! @c.closed?
@@ -169,10 +172,12 @@
assert_equal status, "200 OK"
assert_equal({"Transfer-Encoding" => "chunked" }, headers)
tmp = []
assert body.parser.keepalive?
assert_nothing_raised { body.each { |chunk| tmp << chunk.dup } }
+ assert body.parser.keepalive?
+ assert body.parser.body_eof?
assert_equal [ "abcde" ], tmp
_, status = Process.waitpid2(pid)
assert status.success?
body.close
assert ! @c.closed?
@@ -506,10 +511,10 @@
assert status.success?
body.close
assert @c.closed?
end
- def test_rack_preserve_chunk_no_keepalive
+ def test_rack_preserve_chunk_no_keepalive_2
s = "HTTP/1.1 200 OK\r\n"
s << "Connection: close\r\n"
s << "Content-Length: 666\r\n"
s << "\r\n"
s << "hello"