-
Notifications
You must be signed in to change notification settings - Fork 92
fix(vertex): do not override custom http client when using vertex #238
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
base: main
Are you sure you want to change the base?
Conversation
vertex/vertex.go
Outdated
| sdkoption.WithBaseURL(baseURL), | ||
| sdkoption.WithMiddleware(middleware), | ||
| sdkoption.WithHTTPClient(client), | ||
| sdkoption.WithHTTPClient(&http.Client{Transport: 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.
We need a custom HTTP client here, but this package was essetially overriding it, making our custom client useless.
Here, I'm trying to combine both transports, but I'm sure yet if this is the best way to accomplish it. Seems to have worked well for us, though.
TODO: Handle scenario where Done!rc.HTTPClient is nil. (Probably fallback to the previous code).
| default: | ||
| return nil, fmt.Errorf("vertex middleware does not support %s %s", r.Method, r.URL.Path) |
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.
Looks like if we miss any path, we probably forgot something in the code. A good idea to error here?
57c96d3 to
5ee2923
Compare
7419bf6 to
7b952cd
Compare
7b952cd to
7b1c366
Compare
|
@gcemaj I wonder if you can take a look at this when possible? We're using a fork in the meantime because we need this. Thanks! |
We've been using the
go-vcrlibrary to handle HTTP requests inside tests, and it gives you a custom HTTP transport, but the SDK also sets one. This PR combine both transports so they work together!