Files
node/test/parallel/test-http2-goaway-delayed-request.js
Antoine du Hamel ecbc22dc37 test: ensure assertions are reached on HTTP2 tests
PR-URL: https://github.com/nodejs/node/pull/60730
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-11-17 21:34:43 +01:00

23 lines
609 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const http2 = require('http2');
const server = http2.createServer();
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
client.on('close', common.mustCall(() => {
server.close();
}));
// The client.close() is executed before the socket is able to make request
const stream = client.request();
stream.on('error', common.expectsError({ code: 'ERR_HTTP2_GOAWAY_SESSION' }));
setImmediate(() => client.close());
}));