Skip to content

Accept an interface instead of *http.Client in WithHTTPClient#76

Open
arthurdarcet wants to merge 1 commit intomachinebox:masterfrom
arthurdarcet:patch-1
Open

Accept an interface instead of *http.Client in WithHTTPClient#76
arthurdarcet wants to merge 1 commit intomachinebox:masterfrom
arthurdarcet:patch-1

Conversation

@arthurdarcet
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant