Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2013-04-08 00:50:40 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-04-08 01:17:40 +0400
commiteb39c9854a29f20c9b77eb9379efccd6d245abbb (patch)
treec90584a43410a7e16ac2c807fd90869f36eb124c /test
parent77715edee854ff9f2107a612de28e3fa5e20f8b4 (diff)
net: fix buffer iteration in bytesWritten
Diffstat (limited to 'test')
-rw-r--r--test/simple/test-http-byteswritten.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/simple/test-http-byteswritten.js b/test/simple/test-http-byteswritten.js
index b5e8e579a44..fc090b17dc2 100644
--- a/test/simple/test-http-byteswritten.js
+++ b/test/simple/test-http-byteswritten.js
@@ -34,6 +34,15 @@ var httpServer = http.createServer(function(req, res) {
console.log('ok');
});
res.writeHead(200, { 'Content-Type': 'text/plain' });
+
+ // Write 1mb to cause some requests to buffer
+ var chunk = new Array(1024).join('A');
+ for (var i = 0; i < 1024; i++) {
+ res.write(chunk);
+ }
+ // Get .bytesWritten while buffer is not empty
+ assert(res.connection.bytesWritten > 0);
+
res.end(body);
});