summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-no-content-length.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-http-no-content-length.js')
-rw-r--r--test/parallel/test-http-no-content-length.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/test/parallel/test-http-no-content-length.js b/test/parallel/test-http-no-content-length.js
index dcdf00c402..b27ffda727 100644
--- a/test/parallel/test-http-no-content-length.js
+++ b/test/parallel/test-http-no-content-length.js
@@ -1,26 +1,23 @@
'use strict';
-require('../common');
+const common = require('../common');
var assert = require('assert');
var net = require('net');
var http = require('http');
-var body = '';
-
var server = net.createServer(function(socket) {
// Neither Content-Length nor Connection
socket.end('HTTP/1.1 200 ok\r\n\r\nHello');
-}).listen(0, function() {
- http.get({port: this.address().port}, function(res) {
+}).listen(0, common.mustCall(function() {
+ http.get({port: this.address().port}, common.mustCall(function(res) {
+ var body = '';
+
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
- res.on('end', function() {
+ res.on('end', common.mustCall(function() {
+ assert.strictEqual(body, 'Hello');
server.close();
- });
- });
-});
-
-process.on('exit', function() {
- assert.equal(body, 'Hello');
-});
+ }));
+ }));
+}));