diff --git a/VERSION b/VERSION index 1d0ba9e..267577d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0 +0.4.1 diff --git a/gock/common.go b/gock/common.go index 0b440fb..d34a6d8 100644 --- a/gock/common.go +++ b/gock/common.go @@ -20,10 +20,15 @@ type TransportSetter interface { // annonymous function. type RoundTripper func(req *http.Request) (*http.Response, error) +// RoundTrip implementation to delegate to an anonymous function. +func (r RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + return r(req) +} + // NewErrorRoundTripper static function to create new net/http.RoundTripper that // can be used to test with default http errors while using simple anonymous // functions. -func NewErrorRoundTripper(err error) RoundTripper { +func NewErrorRoundTripper(err error) http.RoundTripper { return RoundTripper(func(_ *http.Request) (*http.Response, error) { return nil, err }) diff --git a/gock/common_test.go b/gock/common_test.go index d92ff38..7b747b4 100644 --- a/gock/common_test.go +++ b/gock/common_test.go @@ -57,7 +57,7 @@ func TestNewErrorRoundTripper(t *testing.T) { roundTripper := gock.NewErrorRoundTripper(param.err) // When - response, err := roundTripper( + response, err := roundTripper.RoundTrip( &http.Request{Method: http.MethodGet}) // Then