You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
497 B

'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
const server = http.createServer((req, res) => {
res.end('ok');
server.close();
}).listen(0, common.mustCall(() => {
http.request({
port: server.address().port,
encoding: 'utf8'
}, common.mustCall((res) => {
let data = '';
res.on('data', (chunk) => data += chunk);
res.on('end', common.mustCall(() => assert.strictEqual(data, 'ok')));
})).end();
}));