summaryrefslogtreecommitdiff
path: root/src/pkg/net/http/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/http/export_test.go')
-rw-r--r--src/pkg/net/http/export_test.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/pkg/net/http/export_test.go b/src/pkg/net/http/export_test.go
index 22b7f2796..960563b24 100644
--- a/src/pkg/net/http/export_test.go
+++ b/src/pkg/net/http/export_test.go
@@ -21,7 +21,7 @@ var ExportAppendTime = appendTime
func (t *Transport) NumPendingRequestsForTesting() int {
t.reqMu.Lock()
defer t.reqMu.Unlock()
- return len(t.reqConn)
+ return len(t.reqCanceler)
}
func (t *Transport) IdleConnKeysForTesting() (keys []string) {
@@ -32,7 +32,7 @@ func (t *Transport) IdleConnKeysForTesting() (keys []string) {
return
}
for key := range t.idleConn {
- keys = append(keys, key)
+ keys = append(keys, key.String())
}
return
}
@@ -43,11 +43,12 @@ func (t *Transport) IdleConnCountForTesting(cacheKey string) int {
if t.idleConn == nil {
return 0
}
- conns, ok := t.idleConn[cacheKey]
- if !ok {
- return 0
+ for k, conns := range t.idleConn {
+ if k.String() == cacheKey {
+ return len(conns)
+ }
}
- return len(conns)
+ return 0
}
func (t *Transport) IdleConnChMapSizeForTesting() int {
@@ -63,4 +64,9 @@ func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler {
return &timeoutHandler{handler, f, ""}
}
+func ResetCachedEnvironment() {
+ httpProxyEnv.reset()
+ noProxyEnv.reset()
+}
+
var DefaultUserAgent = defaultUserAgent