mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
28e6626ce7
IncomingMessage is a Readable stream and should properly set the destroyed property. PR-URL: https://github.com/nodejs/node/pull/33131 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
42 lines
983 B
JavaScript
42 lines
983 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
{
|
|
const server = http.createServer(common.mustCall((req, res) => {
|
|
res.end('asd');
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
http.get({
|
|
port: server.address().port
|
|
}, common.mustCall((res) => {
|
|
assert.strictEqual(res.destroyed, false);
|
|
res.destroy();
|
|
assert.strictEqual(res.destroyed, true);
|
|
res.on('close', common.mustCall(() => {
|
|
server.close();
|
|
}));
|
|
}));
|
|
}));
|
|
}
|
|
|
|
{
|
|
const server = http.createServer(common.mustCall((req, res) => {
|
|
res.end('asd');
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
http.get({
|
|
port: server.address().port
|
|
}, common.mustCall((res) => {
|
|
assert.strictEqual(res.destroyed, false);
|
|
res.on('close', common.mustCall(() => {
|
|
assert.strictEqual(res.destroyed, true);
|
|
server.close();
|
|
})).resume();
|
|
}));
|
|
}));
|
|
}
|