Skip to content

Commit

Permalink
fix(proxy): pass proxy option directly to ProxyAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Apr 1, 2017
1 parent 297fbb6 commit 3398460
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,10 @@ function getAgent (uri, opts) {
// `agent: false` has special behavior!
return opts.agent
} else if (opts.proxy) {
const agentOpts = url.parse(opts.proxy || uri)
if (opts.proxyOpts) {
Object.keys(opts.proxyOpts).forEach(k => {
agentOpts[k] = opts.proxyOpts[k]
})
}
if (!ProxyAgent) {
ProxyAgent = require('proxy-agent')
}
return new ProxyAgent(agentOpts)
return new ProxyAgent(opts.proxy)
} else if (url.parse(uri).protocol === 'https:') {
return https.globalAgent
} else if (url.parse(uri).protocol === 'http:') {
Expand Down

0 comments on commit 3398460

Please sign in to comment.