http2: give name to promisified connect()
PR-URL: https://github.com/nodejs/node/pull/57916 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
dd62456e22
commit
a44ccacb43
@ -25,6 +25,7 @@ const {
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
assignFunctionName,
|
||||
assertCrypto,
|
||||
customInspectSymbol: kInspect,
|
||||
kEmptyObject,
|
||||
@ -3395,7 +3396,7 @@ function connect(authority, options, listener) {
|
||||
// Support util.promisify
|
||||
ObjectDefineProperty(connect, promisify.custom, {
|
||||
__proto__: null,
|
||||
value: (authority, options) => {
|
||||
value: assignFunctionName('connect', function(authority, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const server = connect(authority, options, () => {
|
||||
server.removeListener('error', reject);
|
||||
@ -3404,7 +3405,7 @@ ObjectDefineProperty(connect, promisify.custom, {
|
||||
|
||||
server.once('error', reject);
|
||||
});
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
function createSecureServer(options, handler) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import '../common/index.mjs';
|
||||
import { hasCrypto } from '../common/index.mjs';
|
||||
import assert from 'node:assert';
|
||||
import { promisify } from 'node:util';
|
||||
|
||||
@ -48,3 +48,11 @@ assert.strictEqual(
|
||||
promisify(child_process.execFile).name,
|
||||
'execFile'
|
||||
);
|
||||
|
||||
if (hasCrypto) {
|
||||
const http2 = await import('node:http2');
|
||||
assert.strictEqual(
|
||||
promisify(http2.connect).name,
|
||||
'connect'
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user