Top-gg-Community / go-sdk

Go API wrapper for Discord Bots
MIT License
10 stars 3 forks source link

Support for custom HTTP client to facilitate unit testing #8

Closed ewohltman closed 4 years ago

ewohltman commented 4 years ago

Hello,

I encountered a case where I want to write unit tests with this library, but I don't want to make real HTTP calls to https://top.gg or have to manage secrets/environment variables in my tests.

Unfortunately, the library doesn't seem to expose the *http.Client (or more importantly, the http.RoundTripper) to allow me to mock out the API response.

ewohltman commented 4 years ago

PR https://github.com/DiscordBotList/go-dbl/pull/9 submitted to allow customizing the *http.Client (and therefore the http.RoundTripper) following a pattern already established in the library.