I am having hard time understanding what we need RoundTripper
for in Go.
https://golang.org/pkg/net/http/#RoundTripper
Explains the default Transport
in Go:
var DefaultTransport RoundTripper = &Transport{
Proxy: ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
}
But what would be the difference between RoundTripper
and this:
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSHandshakeTimeout: timeout,
Dial: dialfunc,
DisableKeepAlives: true,
}
My question: is RoundTripper
different than regular Transport
?