nodejs/test/parallel/test-http-response-readable.js

22 lines
581 B
JavaScript
Raw Normal View History

'use strict';
require('../common');
const assert = require('assert');
const http = require('http');
const testServer = new http.Server(function(req, res) {
res.writeHead(200);
res.end('Hello world');
});
testServer.listen(0, function() {
http.get({ port: this.address().port }, function(res) {
assert.strictEqual(res.readable, true, 'res.readable initially true');
res.on('end', function() {
assert.strictEqual(res.readable, false,
'res.readable set to false after end');
testServer.close();
});
2012-12-13 07:47:33 -08:00
res.resume();
});
});