Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.4.1
7 changes: 6 additions & 1 deletion gock/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion gock/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down