fix(proxy): support for all_proxy variables

support for all_proxy variables

Signed-off-by: ysicing <i@ysicing.me>
pull/15/head
ysicing 3 years ago
parent ce057a1aa2
commit ef1adc2f7d

@ -23,6 +23,10 @@ func Proxy() map[string]string {
environ["https_proxy"] = value
environ["HTTPS_PROXY"] = value
}
if value := envAnyCase("all_proxy"); value != "" {
environ["all_proxy"] = value
environ["ALL_PROXY"] = value
}
return environ
}

@ -24,6 +24,8 @@ func TestProxy(t *testing.T) {
return "http://dummy.http.proxy"
case "https_proxy":
return "http://dummy.https.proxy"
case "all_proxy":
return "http://dummy.https.proxy"
default:
return ""
}
@ -36,6 +38,8 @@ func TestProxy(t *testing.T) {
"HTTP_PROXY": "http://dummy.http.proxy",
"https_proxy": "http://dummy.https.proxy",
"HTTPS_PROXY": "http://dummy.https.proxy",
"all_proxy": "http://dummy.https.proxy",
"ALL_PROXY": "http://dummy.https.proxy",
}
b := Proxy()
if diff := cmp.Diff(a, b); diff != "" {

Loading…
Cancel
Save