"io/ioutil"
"net"
"net/http"
+ "net/url"
"strings"
"time"
)
// switch to http so the Transport doesn't try to do an SSL
// negotiation with our dumpConn and its bytes.Buffer & pipe.
// The wire format for https and http are the same, anyway.
+ reqSend := req
if req.URL.Scheme == "https" {
- defer func() { req.URL.Scheme = "https" }()
- req.URL.Scheme = "http"
+ reqSend = new(http.Request)
+ *reqSend = *req
+ reqSend.URL = new(url.URL)
+ *reqSend.URL = *req.URL
+ reqSend.URL.Scheme = "http"
}
// Use the actual Transport code to record what we would send
},
}
- _, err := t.RoundTrip(req)
+ _, err := t.RoundTrip(reqSend)
req.Body = save
if err != nil {