Summary
Instead of always defaulting to http.DefaultClient, allowing passing one during NewClient configuration
Use cases
This would allow one to specify a custom roundtripper without mutating the http.DefaultClient global variable, this could be useful for adding certificates for custom endpoints that use self-signed certificates or are missing intermediaries.
Proposed solution
Simply allow passing an http client in the New* constructors
Is there a workaround to accomplish this today?
Mutate the global http.DefaultClient which is bad practice and has unintended side-effects for shared code
References & Prior Work
Nope
Summary
Instead of always defaulting to
http.DefaultClient, allowing passing one during NewClient configurationUse cases
This would allow one to specify a custom roundtripper without mutating the
http.DefaultClientglobal variable, this could be useful for adding certificates for custom endpoints that use self-signed certificates or are missing intermediaries.Proposed solution
Simply allow passing an http client in the
New*constructorsIs there a workaround to accomplish this today?
Mutate the global
http.DefaultClientwhich is bad practice and has unintended side-effects for shared codeReferences & Prior Work
Nope