graphql icon indicating copy to clipboard operation
graphql copied to clipboard

Accept an interface instead of *http.Client in WithHTTPClient

Open arthurdarcet opened this issue 2 years ago • 0 comments

The WithHTTPClient helper is not really useful if you have to return a real *http.Client. Using an interface here allows us to create custom implementations that can intercept the request and whatever we need with it (such as adding headers)

(adding headers is technically feasible by using a custom Transport wrapped in a real http.Client, but that's not really recommended)

arthurdarcet avatar Apr 05 '23 11:04 arthurdarcet