Skip to content

Commit

Permalink
[https-proxy-agent] Add test for rejectUnauthorized: false missing …
Browse files Browse the repository at this point in the history
…on request options (#148)
  • Loading branch information
TooTallNate committed May 3, 2023
1 parent 1ae55ba commit 06775a8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-wasps-double.md
@@ -0,0 +1,5 @@
---
'https-proxy-agent': patch
---

Add test for `rejectUnauthorized: false` missing on request options
17 changes: 17 additions & 0 deletions packages/https-proxy-agent/test/test.ts
Expand Up @@ -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',
Expand Down

1 comment on commit 06775a8

@vercel
Copy link

@vercel vercel bot commented on 06775a8 May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

proxy-agents – ./

proxy-agents.vercel.app
proxy-agents-git-main-tootallnate.vercel.app
proxy-agents-tootallnate.vercel.app

Please sign in to comment.