Skip to content
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

Support passing a custom *http.Client #165

Closed
jybp opened this issue Sep 27, 2024 · 3 comments
Closed

Support passing a custom *http.Client #165

jybp opened this issue Sep 27, 2024 · 3 comments

Comments

@jybp
Copy link

jybp commented Sep 27, 2024

AFAICT there is no way to currently pass a custom *http.Client to the lib. Meaning consumers have no way to configure it nor can they use custom http.RoundTrippers. It's usually a good practice to have that possibility.

https://github.com/attestantio/go-eth2-client/blob/e02b07f2405232b26018a50a25d9fcd9ed75c205/http/service.go/#L97-L110

Example:
https://github.com/google/go-github/blob/3d410c20b3a7e4496f5b86b7d85c0a51dbaf782e/github/github.go#L315-L328

It's usually passed in a specific constructor or within a functional option.
func WithHttpClient(client *http.Client) Parameter could be added in parameters.go

I could work toward a PR if maintainers have no bandwidth.

@mcdee
Copy link
Contributor

mcdee commented Oct 25, 2024

Please could you take a look at #170 and see if this meets your requirement? Thanks.

@jybp
Copy link
Author

jybp commented Oct 25, 2024

Yes this looks great. Thanks Jim.

@mcdee
Copy link
Contributor

mcdee commented Oct 27, 2024

Closed by #170

@mcdee mcdee closed this as completed Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants