Skip to content

Commit

Permalink
fix: add code property to unsupported proxy url error (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf authored Mar 3, 2022
1 parent 4a9892a commit 569a613
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ function getProxy (proxyUrl, opts, isHttps) {
throw Object.assign(
new Error(`unsupported proxy protocol: '${proxyUrl.protocol}'`),
{
code: 'EUNSUPPORTEDPROXY',
url: proxyUrl.href,
}
)
Expand Down
1 change: 1 addition & 0 deletions test/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ t.test('get proxy agent', async t => {

t.throws(() => getProxy(new url.URL('gopher://proxy.local'), OPTS, false), {
message: 'unsupported proxy protocol: \'gopher:\'',
code: 'EUNSUPPORTEDPROXY',
url: 'gopher://proxy.local',
})
})

0 comments on commit 569a613

Please # to comment.