mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 17:01:08 +00:00

Fixes: https://github.com/nodejs/node/issues/14368 PR-URL: https://github.com/nodejs/node/pull/14387 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
28 lines
585 B
JavaScript
28 lines
585 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
const assert = require('assert');
|
|
|
|
// Fix for https://github.com/nodejs/node/issues/14368
|
|
|
|
const server = http.createServer(handle);
|
|
|
|
function handle(req, res) {
|
|
res.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'write after end');
|
|
server.close();
|
|
}));
|
|
|
|
res.write('hello');
|
|
res.end();
|
|
|
|
setImmediate(common.mustCall(() => {
|
|
res.write('world');
|
|
}));
|
|
}
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
http.get(`http://localhost:${server.address().port}`);
|
|
}));
|