Skip to content

Commit 22c521b

Browse files
committed
http2: give name to promisified connect()
1 parent f43b61e commit 22c521b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/internal/http2/core.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const {
2626
} = primordials;
2727

2828
const {
29+
assignFunctionName,
2930
assertCrypto,
3031
customInspectSymbol: kInspect,
3132
kEmptyObject,
@@ -3405,7 +3406,7 @@ function connect(authority, options, listener) {
34053406
// Support util.promisify
34063407
ObjectDefineProperty(connect, promisify.custom, {
34073408
__proto__: null,
3408-
value: (authority, options) => {
3409+
value: assignFunctionName('connect', function(authority, options) {
34093410
return new Promise((resolve, reject) => {
34103411
const server = connect(authority, options, () => {
34113412
server.removeListener('error', reject);
@@ -3414,7 +3415,7 @@ ObjectDefineProperty(connect, promisify.custom, {
34143415

34153416
server.once('error', reject);
34163417
});
3417-
},
3418+
}),
34183419
});
34193420

34203421
function createSecureServer(options, handler) {

test/parallel/test-util-promisify-custom-names.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import readline from 'node:readline';
1010
import stream from 'node:stream';
1111
import timers from 'node:timers';
1212
import child_process from 'node:child_process';
13+
import http2 from 'node:http2';
1314

1415

1516
assert.strictEqual(
@@ -48,3 +49,8 @@ assert.strictEqual(
4849
promisify(child_process.execFile).name,
4950
'execFile'
5051
);
52+
53+
assert.strictEqual(
54+
promisify(http2.connect).name,
55+
'connect'
56+
);

0 commit comments

Comments
 (0)