lyric-api-go icon indicating copy to clipboard operation
lyric-api-go copied to clipboard

Customize http.Client in lyrics.New()

Open BigB84 opened this issue 4 years ago • 1 comments

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:

  • to be able to use proxies (e.g. for anonymization)
  • increase timeout
  • someone may use predefined config like here
  • ... (All other http.Client goods)

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 :)

BigB84 avatar Dec 03 '21 00:12 BigB84

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.

rhnvrm avatar Dec 06 '21 11:12 rhnvrm