MCPcopy Index your code
hub / github.com/nodejs/node / request

Function request

test/sequential/test-http-server-keep-alive-timeout-slow-server.js:24–42  ·  view source on GitHub ↗
(path, callback)

Source from the content-addressed store, hash-verified

22});
23
24function request(path, callback) {
25 const port = server.address().port;
26 const req = http.request({ agent, path, port }, common.mustCall((res) => {
27 assert.strictEqual(res.statusCode, 200);
28
29 res.setEncoding('utf8');
30
31 let result = '';
32 res.on('data', (chunk) => {
33 result += chunk;
34 });
35
36 res.on('end', common.mustCall(() => {
37 assert.strictEqual(result, 'ok');
38 callback();
39 }));
40 }));
41 req.end();
42}
43
44server.listen(0, common.mustCall(() => {
45 request('/first', () => {

Calls 6

addressMethod · 0.65
requestMethod · 0.65
callbackFunction · 0.50
setEncodingMethod · 0.45
onMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…