Browse Source

Implicitly bypass localhost when proxying requests.

https://chromium-review.googlesource.com/c/chromium/src/+/1303626
deepak1556 6 years ago
parent
commit
d2c0f9f754
1 changed files with 14 additions and 1 deletions
  1. 14 1
      spec/api-session-spec.js

+ 14 - 1
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: '<local>'
       }
       customSession.setProxy(config, () => {
-        customSession.resolveProxy('http://localhost', (proxy) => {
+        customSession.resolveProxy('http://example/', (proxy) => {
           assert.strictEqual(proxy, 'DIRECT')
           done()
         })