(secure = false)
| 284 | } |
| 285 | |
| 286 | async function testHttp2Error(secure = false) { |
| 287 | const port = (secure ? http2SecureServer : http2Server).address().port; |
| 288 | const origin = (secure ? 'https' : 'http') + `://localhost:${port}`; |
| 289 | const errorUrl = `${origin}/trigger-error`; |
| 290 | |
| 291 | const requestWillBeSent = once(session, 'Network.requestWillBeSent'); |
| 292 | session.on('Network.responseReceived', common.mustNotCall()); |
| 293 | session.on('Network.loadingFinished', common.mustNotCall()); |
| 294 | const loadingFailed = once(session, 'Network.loadingFailed'); |
| 295 | |
| 296 | const client = http2.connect(origin, { |
| 297 | rejectUnauthorized: false, |
| 298 | }); |
| 299 | const request = client.request(requestErrorHeaders); |
| 300 | |
| 301 | request.on('close', common.mustCall(() => { |
| 302 | assert.strictEqual(request.rstCode, http2.constants.NGHTTP2_STREAM_CLOSED); |
| 303 | client.close(); |
| 304 | })); |
| 305 | request.on('error', common.expectsError({ |
| 306 | code: 'ERR_HTTP2_STREAM_ERROR', |
| 307 | name: 'Error', |
| 308 | message: 'Stream closed with error code NGHTTP2_STREAM_CLOSED' |
| 309 | })); |
| 310 | request.end(); |
| 311 | |
| 312 | const [ requestEvent ] = await requestWillBeSent; |
| 313 | verifyRequestWillBeSent(requestEvent, errorUrl); |
| 314 | |
| 315 | const [ failed ] = await loadingFailed; |
| 316 | verifyLoadingFailed(failed); |
| 317 | } |
| 318 | |
| 319 | const testNetworkInspection = async () => { |
| 320 | await testHttp2(); |
no test coverage detected
searching dependent graphs…