delegate the reset logic to the test

This commit is contained in:
darkweak 2025-05-27 14:49:57 +02:00 committed by GitHub
parent 3fd729b2a1
commit 4da3da2d0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 7 deletions

View File

@ -102,7 +102,8 @@ func NewTestTimeoutHandler(handler Handler, ctx context.Context) Handler {
}
func ResetCachedEnvironment() {
resetProxyConfig()
envProxyOnce = sync.Once{}
envProxyFuncValue = nil
}
func (t *Transport) NumPendingRequestsForTesting() int {

View File

@ -965,12 +965,6 @@ func envProxyFunc() func(*url.URL) (*url.URL, error) {
return envProxyFuncValue
}
// resetProxyConfig is used by tests.
func resetProxyConfig() {
envProxyOnce = sync.Once{}
envProxyFuncValue = nil
}
func (t *Transport) connectMethodForRequest(treq *transportRequest) (cm connectMethod, err error) {
cm.targetScheme = treq.URL.Scheme
cm.targetAddr = canonicalAddr(treq.URL)