summary refs log tree commit
diff options
context:
space:
mode:
authorFelix Bùˆnemann <buenemann@louis.info>2019-09-09 19:55:58 +0200
committerFelix Bùˆnemann <buenemann@louis.info>2019-09-10 14:50:12 +0200
commit9fbff6e305ad398ed43e70d7c80f4fdd5e7774e4 (patch)
treea19eb996e07ad5f43687a34e443435ae8c6ce5e3
parentf7d0fdebf57024e6d8c674380ce7777927b3b1fe (diff)
downloadrack-9fbff6e305ad398ed43e70d7c80f4fdd5e7774e4.tar.gz
Add failing test for empty parts in Rack::Deflater
-rw-r--r--test/spec_deflater.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/spec_deflater.rb b/test/spec_deflater.rb
index a00b5ec3..18fe831b 100644
--- a/test/spec_deflater.rb
+++ b/test/spec_deflater.rb
@@ -114,6 +114,19 @@ describe Rack::Deflater do
     end
   end
 
+  it 'be able to deflate bodies that respond to each and contain empty chunks' do
+    app_body = Object.new
+    class << app_body; def each; yield('foo'); yield(''); yield('bar'); end; end
+
+    verify(200, 'foobar', deflate_or_gzip, { 'app_body' => app_body }) do |status, headers, body|
+      headers.must_equal({
+        'Content-Encoding' => 'gzip',
+        'Vary' => 'Accept-Encoding',
+        'Content-Type' => 'text/plain'
+      })
+    end
+  end
+
   it 'flush deflated chunks to the client as they become ready' do
     app_body = Object.new
     class << app_body; def each; yield('foo'); yield('bar'); end; end