bitfinexcom / bitfinex-api-go

BITFINEX Go trading API - Bitcoin, Litecoin, and Ether exchange
https://www.bitfinex.com/
MIT License
309 stars 220 forks source link

Custom http client or transport #238

Closed dustin-decker closed 1 year ago

dustin-decker commented 2 years ago

Issue type

Brief description

There is no way to provide a custom http client or transport right now, short of modifying http.DefaultClient (which is not a good practice).

https://github.com/bitfinexcom/bitfinex-api-go/blob/b4f52b0c0faefbac59865ca54bceb07238d7b474/v2/rest/client.go#L88

The DefaultClient should almost never be used because it lacks timeouts.

I would like to provide my own http client or transport so that I can set timeouts and a custom user agent.

dustin-decker commented 1 year ago

func NewClientWithHttpDo does the job https://github.com/bitfinexcom/bitfinex-api-go/blob/master/docs/rest_v2.md#func--newclientwithhttpdo