Skip to content
This repository
Browse code

add test for WEBrick partial hijack

  • Loading branch information...
commit 146614c705b83faabac9a03189a53d3ca5176396 1 parent c5621e9
David Wang authored March 29, 2013

Showing 1 changed file with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. 23  test/spec_webrick.rb
23  test/spec_webrick.rb
@@ -139,5 +139,28 @@
139 139
     }
140 140
   end
141 141
 
  142
+  should "support Rack partial hijack" do
  143
+    io_lambda = lambda{ |io|
  144
+      5.times do
  145
+        io.write "David\r\n"
  146
+      end
  147
+      io.close
  148
+    }
  149
+
  150
+    @server.mount "/partial", Rack::Handler::WEBrick,
  151
+    Rack::Lint.new(lambda{ |req|
  152
+      [
  153
+        200,
  154
+        {"rack.hijack" => io_lambda},
  155
+        [""]
  156
+      ]
  157
+    })
  158
+
  159
+    Net::HTTP.start(@host, @port){ |http|
  160
+      res = http.get("/partial")
  161
+      res.body.should.equal "David\r\nDavid\r\nDavid\r\nDavid\r\nDavid\r\n"
  162
+    }
  163
+  end
  164
+
142 165
   @server.shutdown
143 166
 end

0 notes on commit 146614c

Please sign in to comment.
Something went wrong with that request. Please try again.