Yeah, I thought as much.

I will raise a pull request with the third-party package and implement the 
requirement of a http.Client as an interface that matches the http.Client 
methods used by the package.

Should the standard library http.Client provide an interface for 
http.Client so that third-party packages can accept that instead of the 
concrete stdlib http.Client, or is it the communities opinion that 
third-party packages should create an interface they accept, which covers 
the methods they call?

Cheers,
Ben

On Sunday, December 11, 2016 at 7:59:12 PM UTC, Kevin Conway wrote:
>
> >  How would I swap out a http.Client that is required by a third-party 
> library with a another that supports, say retries with exponential back-off?
> I'd suggest looking at http.Transport and http.RoundTripper [
> https://golang.org/pkg/net/http/#RoundTripper]. The docs explicitly 
> forbid using RoundTripper to implement higher level protocol features like 
> retry-with-backoff based on HTTP response codes, but those are your only 
> hooks into making this a feature of the client rather than moving the retry 
> logic somewhere else.
>
>
> On Sun, Dec 11, 2016 at 4:07 AM <omarsharif...@gmail.com <javascript:>> 
> wrote:
>
>> Just a quick question - I've noticed that the http package doesn't have 
>> an interface for Client. How would I swap out a http.Client that is 
>> required by a third-party library with a another that supports, say retries 
>> with exponential back-off? It appears that it is not possible? Would the 
>> http package benefit from an interface for the http.Client?
>>
>> Cheers!
>> Ben 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to