-
Notifications
You must be signed in to change notification settings - Fork 521
Add HTTP transport decorator #2533
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
Conversation
| retryFunc RetryFunc | ||
| timeout time.Duration | ||
| opts []ClientOption | ||
| transportDecorator TransportDecorator |
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.
Perhaps the client would benefit from having a reference to *clientOptions and not []ClientOption. This way you wouldn't need to copy transportDecorator around. Not sure how big of a change this is.
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.
We use those options later, perhaps we could refactor that part, but there might be some unexpected implications.
This commit adds a new option to the CA client that allows the customization of the HTTP transport.
bbad043 to
e86b66b
Compare
hslatman
left a comment
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.
Just a nit. Approving despite that. Panos may want to approve too.
ca/client.go
Outdated
| return fmt.Errorf("client request failed: %w", err) | ||
| } | ||
|
|
||
| func decorateTransport(tr http.RoundTripper, td TransportDecorator) http.RoundTripper { |
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.
Nit, but it's decorating a RoundTripper; not a *Transport.
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.
True. decorateRoundTripper is better.
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.
I made this change in 63231db, but I left WithTransportDecorator as we are modifying the http.Client.Transport.
This commit adds a new option to the CA client that allows the customization of the HTTP transport.