diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2013-04-10 14:21:41 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2013-04-10 14:51:10 +0400 |
commit | c665b8e9ba22e7ded460b08ca4ca4ea7ef6db9c3 (patch) | |
tree | e3f42c43528ce6d801232845edf266f204c3be00 /test | |
parent | eeb4c3216d9f57bbf404c56bab7b9221cfbf6ae9 (diff) |
net: fix socket.bytesWritten Buffers support
Buffer.byteLength() works only for string inputs. Thus, when connection
has pending Buffer to write, it should just use it's length instead of
throwing exception.
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-http-byteswritten.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/simple/test-http-byteswritten.js b/test/simple/test-http-byteswritten.js index 160ea4d76ee..ff842414cfc 100644 --- a/test/simple/test-http-byteswritten.js +++ b/test/simple/test-http-byteswritten.js @@ -38,8 +38,10 @@ var httpServer = http.createServer(function(req, res) { // Write 1.5mb to cause some requests to buffer // Also, mix up the encodings a bit. var chunk = new Array(1024 + 1).join('7'); + var bchunk = new Buffer(chunk); for (var i = 0; i < 1024; i++) { res.write(chunk); + res.write(bchunk); res.write(chunk, 'hex'); } // Get .bytesWritten while buffer is not empty |