Slightly throttle https large body test
authorTim Caswell <tim@creationix.com>
Fri, 28 Jan 2011 07:37:53 +0000 (23:37 -0800)
committerRyan Dahl <ry@tinyclouds.org>
Fri, 28 Jan 2011 22:35:20 +0000 (14:35 -0800)
test/simple/test-https-large-response.js

index ab80ba2..36d78bb 100644 (file)
@@ -23,7 +23,7 @@ var server = https.createServer(options, function (req, res) {
   console.log('got request');
   res.writeHead(200, { 'content-type': 'text/plain' });
   res.end(body);
-})
+});
 
 var count = 0;
 var gotResEnd = false;
@@ -35,6 +35,10 @@ server.listen(common.PORT, function () {
     res.on('data', function(d) {
       process.stdout.write('.');
       count += d.length;
+      res.pause();
+      process.nextTick(function () {
+        res.resume();
+      });
     });
 
     res.on('end', function(d) {