diff --git a/.changeset/wild-wasps-double.md b/.changeset/wild-wasps-double.md new file mode 100644 index 00000000..f41440cc --- /dev/null +++ b/.changeset/wild-wasps-double.md @@ -0,0 +1,5 @@ +--- +'https-proxy-agent': patch +--- + +Add test for `rejectUnauthorized: false` missing on request options diff --git a/packages/https-proxy-agent/test/test.ts b/packages/https-proxy-agent/test/test.ts index c02e201b..8ecb8210 100644 --- a/packages/https-proxy-agent/test/test.ts +++ b/packages/https-proxy-agent/test/test.ts @@ -197,6 +197,23 @@ describe('HttpsProxyAgent', () => { // The module does seem to work fine on an actual proxy though. const nodeVersion = parseFloat(process.versions.node); + it('should throw an "error" when `rejectUnauthorized: false` is missing', async () => { + const agent = new HttpsProxyAgent(sslProxyUrl, { + rejectUnauthorized: false, + }); + + let err: Error | undefined; + try { + await req(sslServerUrl, { + agent, + }); + } catch (_err) { + err = _err as Error; + } + assert(err); + expect(err.message).toMatch(/self( |-)signed certificate/); + }); + testIf( nodeVersion >= 18, 'should work over an HTTP proxy',