Skip to content

Commit 06775a8

Browse files
authored
[https-proxy-agent] Add test for rejectUnauthorized: false missing on request options (TooTallNate#148)
1 parent 1ae55ba commit 06775a8

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.changeset/wild-wasps-double.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'https-proxy-agent': patch
3+
---
4+
5+
Add test for `rejectUnauthorized: false` missing on request options

packages/https-proxy-agent/test/test.ts

+17
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,23 @@ describe('HttpsProxyAgent', () => {
197197
// The module does seem to work fine on an actual proxy though.
198198
const nodeVersion = parseFloat(process.versions.node);
199199

200+
it('should throw an "error" when `rejectUnauthorized: false` is missing', async () => {
201+
const agent = new HttpsProxyAgent(sslProxyUrl, {
202+
rejectUnauthorized: false,
203+
});
204+
205+
let err: Error | undefined;
206+
try {
207+
await req(sslServerUrl, {
208+
agent,
209+
});
210+
} catch (_err) {
211+
err = _err as Error;
212+
}
213+
assert(err);
214+
expect(err.message).toMatch(/self( |-)signed certificate/);
215+
});
216+
200217
testIf(
201218
nodeVersion >= 18,
202219
'should work over an HTTP proxy',

0 commit comments

Comments
 (0)