mirror of
https://github.com/golang/go
synced 2024-11-27 01:11:20 -07:00
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: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
dd0e1acfeb
commit
eb715fbbbd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user