mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
a6ab883eaa
PR-URL: https://github.com/nodejs/node/pull/32549 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
21 lines
557 B
JavaScript
21 lines
557 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const h2 = require('http2');
|
|
|
|
const server = h2.createServer();
|
|
server.listen(0, common.localhostIPv4, common.mustCall(() => {
|
|
const afterConnect = common.mustCall((session) => {
|
|
session.request({ ':method': 'POST' }).end(common.mustCall(() => {
|
|
session.destroy();
|
|
server.close();
|
|
}));
|
|
});
|
|
|
|
const port = server.address().port;
|
|
const host = common.localhostIPv4;
|
|
h2.connect(`http://${host}:${port}`, afterConnect);
|
|
}));
|