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

Function onStream

test/parallel/test-http2-create-client-secure-session.js:20–36  ·  view source on GitHub ↗
(stream, headers)

Source from the content-addressed store, hash-verified

18}
19
20function onStream(stream, headers) {
21 const socket = stream.session[kSocket];
22
23 assert(stream.session.encrypted);
24 assert.strictEqual(stream.session.alpnProtocol, 'h2');
25 const originSet = stream.session.originSet;
26 assert(Array.isArray(originSet));
27 assert.strictEqual(originSet[0],
28 `https://${socket.servername}:${socket.remotePort}`);
29
30 assert(headers[':authority'].startsWith(socket.servername));
31 stream.respond({ 'content-type': 'application/json' });
32 stream.end(JSON.stringify({
33 servername: socket.servername,
34 alpnProtocol: socket.alpnProtocol
35 }));
36}
37
38function verifySecureSession(key, cert, ca, opts) {
39 const server = h2.createSecureServer({ cert, key });

Callers

nothing calls this directly

Calls 3

assertFunction · 0.50
respondMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…