graphql
graphql copied to clipboard
Accept an interface instead of *http.Client in WithHTTPClient
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)