1
// Copyright 2011 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
5
// Bridge package to expose http internals to tests in the http_test
15
func NewLoggingConn(baseName string, c net.Conn) net.Conn {
16
return newLoggingConn(baseName, c)
19
var ExportAppendTime = appendTime
21
func (t *Transport) NumPendingRequestsForTesting() int {
23
defer t.reqMu.Unlock()
24
return len(t.reqCanceler)
27
func (t *Transport) IdleConnKeysForTesting() (keys []string) {
28
keys = make([]string, 0)
30
defer t.idleMu.Unlock()
31
if t.idleConn == nil {
34
for key := range t.idleConn {
35
keys = append(keys, key.String())
40
func (t *Transport) IdleConnCountForTesting(cacheKey string) int {
42
defer t.idleMu.Unlock()
43
if t.idleConn == nil {
46
for k, conns := range t.idleConn {
47
if k.String() == cacheKey {
54
func (t *Transport) IdleConnChMapSizeForTesting() int {
56
defer t.idleMu.Unlock()
57
return len(t.idleConnCh)
60
func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler {
61
f := func() <-chan time.Time {
64
return &timeoutHandler{handler, f, ""}
67
func ResetCachedEnvironment() {
72
var DefaultUserAgent = defaultUserAgent