h2non / gock

HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

Home Page:https://pkg.go.dev/github.com/h2non/gock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetError not implemented properly

fgblomqvist opened this issue · comments

When using this gock:
gock.New("http://www.google.com"). Get("/").Reply(500).SetError(errors.New("Internal Server Error"))

The following line is printed:
2016/04/18 12:14:03 RoundTripper returned a response & error; ignoring response

I'm guessing the RoundTripper is supposed to return a nil response when the error is set? Or I am supposed to set it to nil somehow?

commented

That case should be mitigated. Will fix it in asap. Thanks for reporting.

commented

Fixed. Try updating the package:

go get -u gopkg.in/h2non/gock.v1