camput: let tinkerTransport's underlying transport be changed

Change-Id: I0b24d593c27b937c961825442801db4c7031c81d
This commit is contained in:
Brad Fitzpatrick 2011-09-24 14:14:41 -07:00
parent 0d31843933
commit c8f8f8d59e
1 changed files with 8 additions and 1 deletions

View File

@ -25,12 +25,19 @@ import (
type tinkerTransport struct {
mu sync.Mutex
reqs int
transport http.RoundTripper
}
func (t *tinkerTransport) RoundTrip(req *http.Request) (resp *http.Response, err os.Error) {
t.mu.Lock()
t.reqs++
rt := t.transport
t.mu.Unlock()
return http.DefaultTransport.RoundTrip(req)
if rt == nil {
rt = http.DefaultTransport
}
return rt.RoundTrip(req)
}