(session, next)
| 33 | } |
| 34 | |
| 35 | function onSession(session, next) { |
| 36 | const headers = { |
| 37 | ':path': '/', |
| 38 | ':method': 'GET', |
| 39 | ':scheme': 'https', |
| 40 | ':authority': `localhost:${this.server.address().port}` |
| 41 | }; |
| 42 | |
| 43 | const request = session.request(headers); |
| 44 | request.on('response', common.mustCall((headers) => { |
| 45 | assert.strictEqual(headers[':status'], 200); |
| 46 | assert.strictEqual(headers['content-type'], 'application/json'); |
| 47 | })); |
| 48 | request.setEncoding('utf8'); |
| 49 | let raw = ''; |
| 50 | request.on('data', (chunk) => { raw += chunk; }); |
| 51 | request.on('end', common.mustCall(() => { |
| 52 | const { alpnProtocol, httpVersion } = JSON.parse(raw); |
| 53 | assert.strictEqual(alpnProtocol, 'h2'); |
| 54 | assert.strictEqual(httpVersion, '2.0'); |
| 55 | |
| 56 | session.close(); |
| 57 | this.cleanup(); |
| 58 | |
| 59 | if (typeof next === 'function') { |
| 60 | next(); |
| 61 | } |
| 62 | })); |
| 63 | request.end(); |
| 64 | } |
| 65 | |
| 66 | // HTTP/2 & HTTP/1.1 server |
| 67 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…