mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 22:25:44 +00:00

PR-URL: https://github.com/nodejs/node/pull/42190 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
23 lines
592 B
JavaScript
23 lines
592 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, () => {
|
|
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());
|
|
});
|