Permalink
Browse files

Add integration test for testing chunked transfer encoding responses.

  • Loading branch information...
1 parent d0b5ce4 commit 5b0abdb73288c286a6929e4b4b73c5a56e5445e1 @FooBarWidget FooBarWidget committed Apr 25, 2011
Showing with 13 additions and 1 deletion.
  1. +7 −0 test/integration_tests/hello_world_rack_spec.rb
  2. +6 −1 test/stub/rack/config.ru
@@ -7,6 +7,13 @@
get('/').should =~ /hello/
end
+ it "supports responses with the 'chunked' transfer encoding" do
+ get('/chunked').should ==
+ "chunk1\n" +
+ "chunk2\n" +
+ "chunk3\n"
+ end
+
it "supports restarting via restart.txt" do
get('/').should =~ /hello/
File.write("#{@stub.app_root}/config.ru", %q{
View
@@ -1,4 +1,9 @@
app = lambda do |env|
- [200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
+ if env['PATH_INFO'] == '/chunked'
+ chunks = ["7\r\nchunk1\n\r\n", "7\r\nchunk2\n\r\n", "7\r\nchunk3\n\r\n", "0\r\n\r\n"]
+ [200, { "Content-Type" => "text/html", "Transfer-Encoding" => "chunked" }, chunks]
+ else
+ [200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
+ end
end
run app

0 comments on commit 5b0abdb

Please sign in to comment.