Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
http: always emit close on req and res
PR-URL: #20611 Fixes: #20600 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
- Loading branch information
Showing
with
18 additions
and 0 deletions.
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const http = require('http'); | ||
|
||
const server = http.Server(common.mustCall((req, res) => { | ||
res.end(); | ||
res.on('finish', common.mustCall()); | ||
res.on('close', common.mustCall()); | ||
req.on('close', common.mustCall()); | ||
res.socket.on('close', () => server.close()); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
http.get({ port: server.address().port }, common.mustCall()); | ||
})); |