From bd1c92bc0b0013291b6ed692f875e5412ea7ab06 Mon Sep 17 00:00:00 2001 From: Carl Johnson Date: Tue, 28 Mar 2023 09:28:33 -0400 Subject: [PATCH] Doer: Inline the Doer type at least for now --- transport.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/transport.go b/transport.go index bd7a481..7b81f08 100644 --- a/transport.go +++ b/transport.go @@ -104,18 +104,14 @@ func (cl closeLogger) Close() error { return cl.ReadCloser.Close() } -// Doer is an interface with a Do method. +// DoerTransport converts a Doer into a Transport. // It exists for compatibility with other libraries. +// A Doer is an interface with a Do method. // Users should prefer Transport, // because Do is the interface of http.Client // which has higher level concerns. -type Doer interface { +func DoerTransport(cl interface { Do(req *http.Request) (*http.Response, error) -} - -// DoerTransport converts a Doer into a Transport. -func DoerTransport(cl Doer) Transport { - return RoundTripFunc(func(req *http.Request) (*http.Response, error) { - return cl.Do(req) - }) +}) Transport { + return RoundTripFunc(cl.Do) }