mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-16 03:32:54 -06:00
deps: Update github.com/hashicorp/go-retryablehttp
This commit is contained in:
parent
84b79dbb9f
commit
6e602b5dce
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
@ -718,7 +718,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/go-retryablehttp",
|
||||
"Rev": "24fda80b7c713c52649e57ce20100d453f7bdb24"
|
||||
"Rev": "5ec125ef739293cb4d57c3456dd92ba9af29ed6e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/go-rootcerts",
|
||||
|
3
vendor/github.com/hashicorp/go-retryablehttp/.gitignore
generated
vendored
Normal file
3
vendor/github.com/hashicorp/go-retryablehttp/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea/
|
||||
*.iml
|
||||
*.test
|
14
vendor/github.com/hashicorp/go-retryablehttp/client.go
generated
vendored
14
vendor/github.com/hashicorp/go-retryablehttp/client.go
generated
vendored
@ -80,6 +80,12 @@ func NewRequest(method, url string, body io.ReadSeeker) (*Request, error) {
|
||||
return &Request{body, httpReq}, nil
|
||||
}
|
||||
|
||||
// RequestLogHook allows a function to run before each retry. The HTTP
|
||||
// request which will be made, and the retry number (0 for the initial
|
||||
// request) are available to users. The internal logger is exposed to
|
||||
// consumers.
|
||||
type RequestLogHook func(*log.Logger, *http.Request, int)
|
||||
|
||||
// Client is used to make HTTP requests. It adds additional functionality
|
||||
// like automatic retries to tolerate minor outages.
|
||||
type Client struct {
|
||||
@ -89,6 +95,10 @@ type Client struct {
|
||||
RetryWaitMin time.Duration // Minimum time to wait
|
||||
RetryWaitMax time.Duration // Maximum time to wait
|
||||
RetryMax int // Maximum number of retries
|
||||
|
||||
// RequestLogHook allows a user-supplied function to be called
|
||||
// before each retry.
|
||||
RequestLogHook RequestLogHook
|
||||
}
|
||||
|
||||
// NewClient creates a new Client with default settings.
|
||||
@ -116,6 +126,10 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if c.RequestLogHook != nil {
|
||||
c.RequestLogHook(c.Logger, req.Request, i)
|
||||
}
|
||||
|
||||
// Attempt the request
|
||||
resp, err := c.HTTPClient.Do(req.Request)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user