mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
eacd45656a
PR-URL: https://github.com/nodejs/node/pull/42163 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
38 lines
808 B
JavaScript
38 lines
808 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const net = require('net');
|
|
|
|
const originalConnect = net.Socket.prototype.connect;
|
|
|
|
net.Socket.prototype.connect = common.mustCall(function(args) {
|
|
assert.strictEqual(args[0].noDelay, true);
|
|
return originalConnect.call(this, args);
|
|
});
|
|
|
|
const server = http.createServer(common.mustCall((req, res) => {
|
|
res.writeHead(200);
|
|
res.end();
|
|
server.close();
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
assert.strictEqual(server.noDelay, true);
|
|
|
|
const req = http.request({
|
|
method: 'GET',
|
|
port: server.address().port
|
|
}, common.mustCall((res) => {
|
|
res.on('end', () => {
|
|
server.close();
|
|
res.req.socket.end();
|
|
});
|
|
|
|
res.resume();
|
|
}));
|
|
|
|
req.end();
|
|
}));
|