test: stream.finished detects a destroyed IncomingMessage
Add a test to verify that stream.finished works correctly on IncomingMessage refs: https://github.com/nodejs/node/issues/38657 PR-URL: https://github.com/nodejs/node/pull/38661 Refs: https://github.com/nodejs/node/issues/38657 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
6e6663b8a4
commit
cbe0f0959e
@ -553,14 +553,14 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const server = http.createServer((req, res) => {
|
const server = http.createServer(common.mustCall((req, res) => {
|
||||||
res.on('close', () => {
|
res.on('close', common.mustCall(() => {
|
||||||
finished(res, common.mustCall(() => {
|
finished(res, common.mustCall(() => {
|
||||||
server.close();
|
server.close();
|
||||||
}));
|
}));
|
||||||
});
|
}));
|
||||||
res.end();
|
res.end();
|
||||||
})
|
}))
|
||||||
.listen(0, function() {
|
.listen(0, function() {
|
||||||
http.request({
|
http.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -570,6 +570,22 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const server = http.createServer(common.mustCall((req, res) => {
|
||||||
|
req.on('close', common.mustCall(() => {
|
||||||
|
finished(req, common.mustCall(() => {
|
||||||
|
server.close();
|
||||||
|
}));
|
||||||
|
}));
|
||||||
|
req.destroy();
|
||||||
|
})).listen(0, function() {
|
||||||
|
http.request({
|
||||||
|
method: 'GET',
|
||||||
|
port: this.address().port
|
||||||
|
}).end().on('error', common.mustCall());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const w = new Writable({
|
const w = new Writable({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user