2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-05-29 03:06:56 -04:00
|
|
|
require('../common');
|
2016-12-30 18:38:06 -05:00
|
|
|
const assert = require('assert');
|
|
|
|
const http = require('http');
|
2011-07-29 23:49:48 +09:00
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
const server = http.Server(function(req, res) {
|
2011-07-29 23:49:48 +09:00
|
|
|
res.writeHead(200, {'Content-Type': 'text/plain'});
|
2011-10-04 18:08:18 -04:00
|
|
|
res.end('hello world\n');
|
2011-07-29 23:49:48 +09:00
|
|
|
});
|
2016-05-29 03:06:56 -04:00
|
|
|
server.listen(0, function() {
|
2017-01-08 13:19:00 +00:00
|
|
|
const req = http.get({port: this.address().port}, function(res) {
|
2011-07-29 23:49:48 +09:00
|
|
|
res.on('end', function() {
|
|
|
|
assert.ok(!req.end());
|
|
|
|
server.close();
|
|
|
|
});
|
2012-12-13 07:47:33 -08:00
|
|
|
res.resume();
|
2011-07-29 23:49:48 +09:00
|
|
|
});
|
|
|
|
});
|