gobuch/microservices/http-retry/client/main.go

22 lines
370 B
Go
Raw Permalink Normal View History

2020-08-21 04:26:40 +00:00
package main
import (
"log"
"github.com/hashicorp/go-retryablehttp"
)
func main() {
retryClient := retryablehttp.NewClient()
retryClient.RetryMax = 10
standardClient := retryClient.StandardClient()
res, err := standardClient.Get("http://localhost:8080/")
if err != nil {
log.Fatal("could not request")
}
defer res.Body.Close()
log.Println(res.Status)
}