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

Function testRequest

test/parallel/test-http2-pack-end-stream-flag.js:32–53  ·  view source on GitHub ↗
(path, targetFrameCount, callback)

Source from the content-addressed store, hash-verified

30});
31
32function testRequest(path, targetFrameCount, callback) {
33 const obs = new PerformanceObserver(
34 common.mustCallAtLeast((list, observer) => {
35 const entries = list.getEntries();
36 for (let n = 0; n < entries.length; n++) {
37 const entry = entries[n];
38 if (entry.name !== 'Http2Session') continue;
39 if (entry.detail.type !== 'client') continue;
40 assert.strictEqual(entry.detail.framesReceived, targetFrameCount);
41 observer.disconnect();
42 callback();
43 }
44 }));
45 obs.observe({ type: 'http2' });
46 const client =
47 http2.connect(`http://localhost:${server.address().port}`, () => {
48 const req = client.request({ ':path': path });
49 req.resume();
50 req.end();
51 req.on('end', () => client.close());
52 });
53}
54
55// SETTINGS => SETTINGS => HEADERS => DATA
56const MIN_FRAME_COUNT = 4;

Calls 11

observeMethod · 0.95
callbackFunction · 0.70
disconnectMethod · 0.65
connectMethod · 0.65
addressMethod · 0.65
requestMethod · 0.65
resumeMethod · 0.65
closeMethod · 0.65
getEntriesMethod · 0.45
endMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected