Skip to content

Commit 8e5d8dd

Browse files
committed
Fix Node.js 19+ compatibility bug.
Fix logic bug in the Node.js version check in the Agent conversion code so it can run with major > 18 and minor < 2, such as 20.0.0.
1 parent 3690b34 commit 8e5d8dd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
- Use httpbin for valid cert HTTPS testing.
88
- Add local server self-signed certificate HTTPS test.
99

10+
### Fixed
11+
- Fix Node.js 19+ compatibility bug.
12+
1013
## 3.4.0 - 2023-04-14
1114

1215
### Changed

lib/agentCompatibility.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const AGENT_CACHE = new WeakMap();
1010

1111
// can only convert agent to dispatcher option on node 18.2+
1212
const [major, minor] = versions.node.split('.');
13-
const canConvert = parseInt(major, 10) >= 18 && parseInt(minor, 10) >= 2;
13+
const canConvert =
14+
(parseInt(major, 10) > 18) ||
15+
(parseInt(major, 10) === 18 && parseInt(minor, 10) >= 2);
1416

1517
// converts `agent`/`httpsAgent` option to a dispatcher option
1618
export function convertAgent(options) {

0 commit comments

Comments
 (0)