From d2c0f9f754b6d9cf00226927a557fae217bec255 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Sat, 12 Jan 2019 16:47:01 +0530 Subject: [PATCH] Implicitly bypass localhost when proxying requests. https://chromium-review.googlesource.com/c/chromium/src/+/1303626 --- spec/api-session-spec.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index a578f0dc4eb8..9a536b090e0a 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -562,6 +562,19 @@ describe('session module', () => { it('allows configuring proxy settings', (done) => { 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.resolveProxy('http://localhost', (proxy) => { assert.strictEqual(proxy, 'PROXY myproxy:80') @@ -599,7 +612,7 @@ describe('session module', () => { proxyBypassRules: '' } customSession.setProxy(config, () => { - customSession.resolveProxy('http://localhost', (proxy) => { + customSession.resolveProxy('http://example/', (proxy) => { assert.strictEqual(proxy, 'DIRECT') done() })