diff --git a/lib/agent.js b/lib/agent.js index cc1d388..d28a31b 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -198,6 +198,7 @@ function getProxy (proxyUrl, opts, isHttps) { throw Object.assign( new Error(`unsupported proxy protocol: '${proxyUrl.protocol}'`), { + code: 'EUNSUPPORTEDPROXY', url: proxyUrl.href, } ) diff --git a/test/agent.js b/test/agent.js index 9f40bef..522a6c7 100644 --- a/test/agent.js +++ b/test/agent.js @@ -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', }) })