Commit eb715fbb authored by Chew Choon Keat's avatar Chew Choon Keat Committed by Brad Fitzpatrick

net/http: unset proxy environment after test

Fix last proxy in TestProxyFromEnvironment bleeds into other tests
Change ResetProxyEnv to use the newer os.Unsetenv, instead of hard
coding as ""

Change-Id: I67cf833dbcf4bec2e10ea73c354334160cf05f84
Reviewed-on: https://go-review.googlesource.com/38115
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent dd0e1acf
......@@ -75,7 +75,7 @@ func TestCacheKeys(t *testing.T) {
func ResetProxyEnv() {
for _, v := range []string{"HTTP_PROXY", "http_proxy", "NO_PROXY", "no_proxy"} {
os.Setenv(v, "")
os.Unsetenv(v)
}
ResetCachedEnvironment()
}
......@@ -2243,6 +2243,7 @@ var proxyFromEnvTests = []proxyFromEnvTest{
func TestProxyFromEnvironment(t *testing.T) {
ResetProxyEnv()
defer ResetProxyEnv()
for _, tt := range proxyFromEnvTests {
os.Setenv("HTTP_PROXY", tt.env)
os.Setenv("HTTPS_PROXY", tt.httpsenv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment