session: add proxyBypassRules option to setProxy api
This commit is contained in:
parent
a0c5749ac1
commit
aa6d79a3d8
3 changed files with 69 additions and 1 deletions
|
@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue