http: don't emit 'readable' after 'close'

PR-URL: https://github.com/nodejs/node/pull/32277
Refs: https://github.com/nodejs/node/issues/28710
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Robert Nagy 2020-03-15 01:34:01 +01:00 committed by Anna Henningsen
parent 19db0e60bd
commit e034f5c3d9
No known key found for this signature in database
GPG key ID: A94130F0BFC8EBE9
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');
const http = require('http');
@ -45,6 +45,9 @@ async_hooks.createHook({
}).enable();
const server = http.createServer((req, res) => {
req.on('close', common.mustCall(() => {
req.on('readable', common.mustNotCall());
}));
res.end('Hello');
});