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

Method createConnection

test/parallel/test-http-client-readable.js:30–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29class FakeAgent extends http.Agent {
30 createConnection() {
31 const s = new Duplex();
32 let once = false;
33
34 s._read = function() {
35 if (once)
36 return this.push(null);
37 once = true;
38
39 this.push('HTTP/1.1 200 Ok\r\nTransfer-Encoding: chunked\r\n\r\n');
40 this.push('b\r\nhello world\r\n');
41 this.readable = false;
42 this.push('0\r\n\r\n');
43 };
44
45 // Blackhole
46 s._write = function(data, enc, cb) {
47 cb();
48 };
49
50 s.destroy = s.destroySoon = function() {
51 this.writable = false;
52 };
53
54 return s;
55 }
56}
57
58let received = '';

Callers 15

ClientRequestFunction · 0.45
_http_agent.jsFile · 0.45
connectFunction · 0.45
doBenchFunction · 0.45
runClientFunction · 0.45
test-net-pause.jsFile · 0.45
createLocalConnectionFunction · 0.45

Calls 2

cbFunction · 0.70
pushMethod · 0.45

Tested by 2

testFunction · 0.36
testFunction · 0.36