Implicitly bypass localhost when proxying requests.

https://chromium-review.googlesource.com/c/chromium/src/+/1303626
This commit is contained in:
deepak1556 2019-01-12 16:47:01 +05:30 committed by Jeremy Apthorp
parent 03d499bf34
commit d2c0f9f754

View file

@ -562,6 +562,19 @@ describe('session module', () => {
it('allows configuring proxy settings', (done) => { it('allows configuring proxy settings', (done) => {
const config = { proxyRules: 'http=myproxy:80' } const config = { proxyRules: 'http=myproxy:80' }
customSession.setProxy(config, () => {
customSession.resolveProxy('http://example.com/', (proxy) => {
assert.strictEqual(proxy, 'PROXY myproxy:80')
done()
})
})
})
it('allows removing the implicit bypass rules for localhost', (done) => {
const config = {
proxyRules: 'http=myproxy:80',
proxyBypassRules: '<-loopback>'
}
customSession.setProxy(config, () => { customSession.setProxy(config, () => {
customSession.resolveProxy('http://localhost', (proxy) => { customSession.resolveProxy('http://localhost', (proxy) => {
assert.strictEqual(proxy, 'PROXY myproxy:80') assert.strictEqual(proxy, 'PROXY myproxy:80')
@ -599,7 +612,7 @@ describe('session module', () => {
proxyBypassRules: '<local>' proxyBypassRules: '<local>'
} }
customSession.setProxy(config, () => { customSession.setProxy(config, () => {
customSession.resolveProxy('http://localhost', (proxy) => { customSession.resolveProxy('http://example/', (proxy) => {
assert.strictEqual(proxy, 'DIRECT') assert.strictEqual(proxy, 'DIRECT')
done() done()
}) })