mirror of https://github.com/actions/toolkit
Support '*' wildcard (#1355)
parent
1f4b3fac06
commit
d47e0bac60
|
@ -176,11 +176,16 @@ describe('proxy', () => {
|
||||||
expect(bypass).toBeTruthy()
|
expect(bypass).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
// Do not match wildcard ("*") as per https://github.com/actions/runner/blob/97195bad5870e2ad0915ebfef1616083aacf5818/docs/adrs/0263-proxy-support.md
|
|
||||||
it('checkBypass returns true if no_proxy is "*"', () => {
|
it('checkBypass returns true if no_proxy is "*"', () => {
|
||||||
process.env['no_proxy'] = '*'
|
process.env['no_proxy'] = '*'
|
||||||
const bypass = pm.checkBypass(new URL('https://anything.whatsoever.com'))
|
const bypass = pm.checkBypass(new URL('https://anything.whatsoever.com'))
|
||||||
expect(bypass).toBeFalsy()
|
expect(bypass).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns true if no_proxy contains comma separated "*"', () => {
|
||||||
|
process.env['no_proxy'] = 'domain.com,* , example.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://anything.whatsoever.com'))
|
||||||
|
expect(bypass).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('HttpClient does basic http get request through proxy', async () => {
|
it('HttpClient does basic http get request through proxy', async () => {
|
||||||
|
|
|
@ -52,6 +52,7 @@ export function checkBypass(reqUrl: URL): boolean {
|
||||||
.map(x => x.trim().toUpperCase())
|
.map(x => x.trim().toUpperCase())
|
||||||
.filter(x => x)) {
|
.filter(x => x)) {
|
||||||
if (
|
if (
|
||||||
|
upperNoProxyItem === '*' ||
|
||||||
upperReqHosts.some(
|
upperReqHosts.some(
|
||||||
x =>
|
x =>
|
||||||
x === upperNoProxyItem ||
|
x === upperNoProxyItem ||
|
||||||
|
|
Loading…
Reference in New Issue