spacecodewor / fmpcloud-go

Go API client for Financial Modeling Prep (fmpcloud.io)
MIT License
24 stars 14 forks source link

Export Resty client or allow custom http.Client #5

Closed mariusgrigoriu closed 3 years ago

mariusgrigoriu commented 3 years ago

It would be nice if the resty.Client created in https://github.com/spacecodewor/fmpcloud-go/blob/00b9fb5b9925ef3375b6be27d4dfb5c4d19f1535/client.go#L70 were exported (ideally in APIClient) or if Config would take a custom http.Client for resty. This would facilitate testing code that depends on the fmpcloud library using tools like httpmock: https://github.com/go-resty/resty#mocking-http-requests-using-httpmock-library

What do you think?

spacecodewor commented 3 years ago

It would be nice if the resty.Client created in

https://github.com/spacecodewor/fmpcloud-go/blob/00b9fb5b9925ef3375b6be27d4dfb5c4d19f1535/client.go#L70

were exported (ideally in APIClient) or if Config would take a custom http.Client for resty. This would facilitate testing code that depends on the fmpcloud library using tools like httpmock: https://github.com/go-resty/resty#mocking-http-requests-using-httpmock-library What do you think?

Hi, I think this is a good idea. I will do it soon.

spacecodewor commented 3 years ago

Hi, check in ver 2.6.0

mariusgrigoriu commented 3 years ago

Confirmed it works. Thank you.