Merge pull request #15 from ysicing/imp-proxy-envs

feat(proxy): support for all_proxy variables
pull/17/head
TP Honey 3 years ago committed by GitHub
commit 64ce52406a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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