rhnvrm / lyric-api-go

:musical_score: API to search for lyrics from various providers.
MIT License
18 stars 8 forks source link

Customize http.Client in lyrics.New() #3

Open BigB84 opened 2 years ago

BigB84 commented 2 years ago

Hi,

thanks for such great, easy-to-use API !

I'd like to be able to customize http.Client in every provider (I mean If I use multiple providers at one time, same config'd be passed to each one) Also, from what I've found out, currently only musixmatch uses http.Client: https://github.com/rhnvrm/lyric-api-go/blob/6e1e54754131aed4ffca9a83ec7cd7586e6a3c06/musixmatch/fetch.go#L27

Example usage case:

This could be controlled like below:

import ("github.com/hashicorp/go-retryablehttp")
...
myClient := retryablehttp.NewClient().StandardClient() // Example of modified http.Client predefined in above lib
l := lyrics.New(myClient) // Passing it to the lyrics provider
...

Thanks in advance :)

rhnvrm commented 2 years ago

Hey @BigB84, I have a draft open at #4. If you could please review / test it out that would be helpful as I don't use this project anymore in my production side projects.