From c8f8f8d59e1b5e19c86788bed90c1d2420ff6047 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 24 Sep 2011 14:14:41 -0700 Subject: [PATCH] camput: let tinkerTransport's underlying transport be changed Change-Id: I0b24d593c27b937c961825442801db4c7031c81d --- clients/go/camput/transport.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clients/go/camput/transport.go b/clients/go/camput/transport.go index 8e6421b4f..1f8661d96 100644 --- a/clients/go/camput/transport.go +++ b/clients/go/camput/transport.go @@ -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) }