michiwend / gomusicbrainz

a Go (Golang) MusicBrainz WS2 client library - work in progress
MIT License
57 stars 24 forks source link

Possibility of setting the http client from the caller #17

Open mariusor opened 3 weeks ago

mariusor commented 3 weeks ago

Hi,

I would like to know if you'd entertain a PR to allow setting the http.Client from outside of the API, either as a member of the WS2Client or as a static variable for the entire module.

My personal need is to inject such a client with support for a http.Transport that obeys request limits.

In the current form this is impossible and my application aborts when the client gets rate limited.

michiwend commented 3 weeks ago

Hi @mariusor. I haven't really been actively working on this project but what you suggest sounds like a sensible change to make. Please feel free to prepare a PR and I'll have a look. Thank you for your contribution!

michiwend commented 3 weeks ago

One thing we need to consider, though is to not break the API of this library with this proposed change

mariusor commented 1 week ago

I created a PR with the simplest non breaking API I could think of.

@michiwend let me know if you want me to make any changes.