mirror of https://github.com/perkeep/perkeep.git
camput: let tinkerTransport's underlying transport be changed
Change-Id: I0b24d593c27b937c961825442801db4c7031c81d
This commit is contained in:
parent
0d31843933
commit
c8f8f8d59e
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue