gobuch/microservices/http-retry/client/main.go
2020-08-21 06:26:40 +02:00

22 lines
370 B
Go

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)
}