diff options
Diffstat (limited to 'test/parallel/test-http-write-empty-string.js')
-rw-r--r-- | test/parallel/test-http-write-empty-string.js | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/test/parallel/test-http-write-empty-string.js b/test/parallel/test-http-write-empty-string.js index 6ae723e306..534a55823a 100644 --- a/test/parallel/test-http-write-empty-string.js +++ b/test/parallel/test-http-write-empty-string.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); var assert = require('assert'); var http = require('http'); @@ -17,20 +17,17 @@ var server = http.createServer(function(request, response) { this.close(); }); -var response = ''; +server.listen(0, common.mustCall(function() { + http.get({ port: this.address().port }, common.mustCall(function(res) { + var response = ''; -process.on('exit', function() { - assert.equal('1\n2\n3\n', response); -}); - - -server.listen(0, function() { - http.get({ port: this.address().port }, function(res) { assert.equal(200, res.statusCode); res.setEncoding('ascii'); res.on('data', function(chunk) { response += chunk; }); - }); -}); - + res.on('end', common.mustCall(function() { + assert.strictEqual('1\n2\n3\n', response); + })); + })); +})); |