(requestURL)
| 24 | } |
| 25 | |
| 26 | const shouldBypassProxy = (requestURL) => { |
| 27 | const noProxy = process.env.NO_PROXY || process.env.no_proxy || '' |
| 28 | if (noProxy === '*') return true |
| 29 | if (noProxy === '') return false |
| 30 | |
| 31 | const port = |
| 32 | requestURL.port || (requestURL.protocol === 'https:' ? '443' : '80') |
| 33 | const hostname = formatHostName(requestURL.hostname) |
| 34 | |
| 35 | return noProxy |
| 36 | .split(',') |
| 37 | .map(parseNoProxyZone) |
| 38 | .some((noProxyZone) => { |
| 39 | const isMatchedAt = hostname.indexOf(noProxyZone.hostname) |
| 40 | const hostnameMatched = |
| 41 | isMatchedAt > -1 && |
| 42 | isMatchedAt === hostname.length - noProxyZone.hostname.length |
| 43 | if (noProxyZone.hasPort) { |
| 44 | return port === noProxyZone.port && hostnameMatched |
| 45 | } |
| 46 | return hostnameMatched |
| 47 | }) |
| 48 | } |
| 49 | |
| 50 | const getProxyUrl = (url) => { |
| 51 | const requestURL = new URL(url) |
no test coverage detected
searching dependent graphs…