(hostname: string, noProxy: string[])
| 58 | } |
| 59 | |
| 60 | function shouldBypass(hostname: string, noProxy: string[]): boolean { |
| 61 | if (noProxy.length === 0) return false; |
| 62 | const h = hostname.toLowerCase(); |
| 63 | for (const rule of noProxy) { |
| 64 | if (rule === '*') return true; |
| 65 | if (rule === h) return true; |
| 66 | // ".foo.com" or "foo.com" → match exact and suffix |
| 67 | const stripped = rule.startsWith('.') ? rule.slice(1) : rule; |
| 68 | if (h === stripped) return true; |
| 69 | if (h.endsWith('.' + stripped)) return true; |
| 70 | } |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Resolve the right dispatcher for a given URL. Returns: |
no outgoing calls
no test coverage detected