MCPcopy Create free account
hub / github.com/nodejs/node / second

Function second

test/parallel/test-http-agent-keepalive.js:65–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65function second() {
66 // Request second, use the same socket
67 const req = get('/second', common.mustCall((res) => {
68 assert.strictEqual(req.reusedSocket, true);
69 assert.strictEqual(res.statusCode, 200);
70 res.on('data', checkDataAndSockets);
71 res.on('end', common.mustCall(() => {
72 assert.strictEqual(agent.sockets[name].length, 1);
73 assert.strictEqual(agent.freeSockets[name], undefined);
74 process.nextTick(common.mustCall(() => {
75 assert.strictEqual(agent.sockets[name], undefined);
76 assert.strictEqual(agent.freeSockets[name].length, 1);
77 assert.strictEqual(agent.totalSocketCount, 1);
78 remoteClose();
79 }));
80 }));
81 }));
82}
83
84function remoteClose() {
85 // Mock remote server close the socket

Callers 1

Calls 3

remoteCloseFunction · 0.85
getFunction · 0.70
onMethod · 0.45

Tested by

no test coverage detected