I would like to understand how to use go-retryablehttp with a Client with a custom Transport, let's say for instance to disable TLS validation, how can this be achieved?
I would like to understand how to use go-retryablehttp with a Client with a custom Transport, let's say for instance to disable TLS validation, how can this be achieved?
You can access the underlying http client as seen in this issue. Here is a small example of ignoring an self signed cert error at 127.0.0.1:8030
package main
import (
"crypto/tls"
"github.com/hashicorp/go-retryablehttp"
"net/http"
)
func main() {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
retryClient := retryablehttp.NewClient()
retryClient.HTTPClient.Transport = tr
req, err := retryablehttp.NewRequest("GET", "https://127.0.0.1:8030", nil)
if err != nil {
panic(err)
}
_, err = retryClient.Do(req)
if err != nil {
panic(err)
}
}