[feat] Add retries for HTTP operations#218
[feat] Add retries for HTTP operations#218radeksimko merged 6 commits intohashicorp:mainfrom james0209:retryable-http
Conversation
radeksimko
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Could we keep the HTTP client logic in that httpclient package and also retain the logic which adds the User-Agent header?
For example:
// NewHTTPClient provides a pre-configured http.Client
// e.g. with relevant User-Agent header
func NewHTTPClient() *http.Client {
client := retryablehttp.NewClient().StandardClient()
client.Transport = &userAgentRoundTripper{
userAgent: fmt.Sprintf("hc-install/%s", version.Version()),
inner: client.Transport,
}
return client
}
@radeksimko I've got no problem putting it in the Although from what I can tell, the UserAgent is not used currently. It is set on something called I could do something like you suggested above if you would like UserAgent to actually be utilized? |
Yes, I noticed it isn't used - that was certainly not intentional - i.e. that's a bug that would be worth addressing also.
Yes please. |
What
Use go-retryablehttp for retryable network operations.
Why
closes #140