Skip to content

Commit 9f2c705

Browse files
KhafraDevcrysmags
authored andcommitted
fix undici when node is built with --without-ssl (nodejs#2272)
1 parent 426cdd3 commit 9f2c705

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/client.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
const assert = require('assert')
88
const net = require('net')
9-
const http2 = require('http2')
109
const { pipeline } = require('stream')
1110
const util = require('./core/util')
1211
const timers = require('./timers')
@@ -79,6 +78,16 @@ const {
7978
kHTTP2CopyHeaders,
8079
kHTTP1BuildRequest
8180
} = require('./core/symbols')
81+
82+
/** @type {import('http2')} */
83+
let http2
84+
try {
85+
http2 = require('http2')
86+
} catch {
87+
// @ts-ignore
88+
http2 = { constants: {} }
89+
}
90+
8291
const {
8392
constants: {
8493
HTTP2_HEADER_AUTHORITY,

0 commit comments

Comments
 (0)