mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
16920db55e
This reverts commit e2f5bb7574
.
Reverted as it caused a significant performance regression.
See: https://github.com/nodejs/node/issues/37937
PR-URL: https://github.com/nodejs/node/pull/37963
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const onWriteAfterEndError = common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ERR_STREAM_WRITE_AFTER_END');
|
|
}, 2);
|
|
|
|
const server = http.createServer(common.mustCall(function(req, res) {
|
|
res.end('testing ended state', common.mustCall());
|
|
assert.strictEqual(res.writableCorked, 0);
|
|
res.end(common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ERR_STREAM_ALREADY_FINISHED');
|
|
}));
|
|
assert.strictEqual(res.writableCorked, 0);
|
|
res.end('end', onWriteAfterEndError);
|
|
assert.strictEqual(res.writableCorked, 0);
|
|
res.on('error', onWriteAfterEndError);
|
|
res.on('finish', common.mustCall(() => {
|
|
res.end(common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ERR_STREAM_ALREADY_FINISHED');
|
|
server.close();
|
|
}));
|
|
}));
|
|
}));
|
|
|
|
server.listen(0);
|
|
|
|
server.on('listening', common.mustCall(function() {
|
|
http
|
|
.request({
|
|
port: server.address().port,
|
|
method: 'GET',
|
|
path: '/'
|
|
})
|
|
.end();
|
|
}));
|