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-03-31 17:02:14 -04:00
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
const testServer = new http.Server(function(req, res) {
|
2011-03-31 17:02:14 -04:00
|
|
|
res.writeHead(200);
|
|
|
|
res.end('Hello world');
|
|
|
|
});
|
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
testServer.listen(0, function() {
|
|
|
|
http.get({ port: this.address().port }, function(res) {
|
2017-01-08 15:36:25 +00:00
|
|
|
assert.strictEqual(res.readable, true, 'res.readable initially true');
|
2011-03-31 17:02:14 -04:00
|
|
|
res.on('end', function() {
|
2017-01-08 15:36:25 +00:00
|
|
|
assert.strictEqual(res.readable, false,
|
|
|
|
'res.readable set to false after end');
|
2011-03-31 17:02:14 -04:00
|
|
|
testServer.close();
|
|
|
|
});
|
2012-12-13 07:47:33 -08:00
|
|
|
res.resume();
|
2011-03-31 17:02:14 -04:00
|
|
|
});
|
|
|
|
});
|