Merge pull request #6558 from deepak1556/session_proxy_patch

session: add proxyBypassRules option to setProxy api
This commit is contained in:
Cheng Zhao 2016-07-25 16:03:50 +09:00 committed by GitHub
commit fd8cc63ca9
3 changed files with 69 additions and 1 deletions

View file

@ -342,4 +342,31 @@ describe('session module', function () {
w.loadURL(`${protocolName}://fake-host`)
})
})
describe('ses.setProxy(options, callback)', function () {
it('allows configuring proxy settings', function (done) {
const config = {
proxyRules: 'http=myproxy:80'
}
session.defaultSession.setProxy(config, function () {
session.defaultSession.resolveProxy('http://localhost', function (proxy) {
assert.equal(proxy, 'PROXY myproxy:80')
done()
})
})
})
it('allows bypassing proxy settings', function (done) {
const config = {
proxyRules: 'http=myproxy:80',
proxyBypassRules: '<local>'
}
session.defaultSession.setProxy(config, function () {
session.defaultSession.resolveProxy('http://localhost', function (proxy) {
assert.equal(proxy, 'DIRECT')
done()
})
})
})
})
})