-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Add retries for HTTP operations #218
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What
Use go-retryablehttp for retryable network operations.
Why
closes #140