test_round_tripper.go 377 B

1234567891011121314151617
  1. package http
  2. import (
  3. "github.com/stretchr/testify/mock"
  4. "net/http"
  5. )
  6. // TestRoundTripper DEPRECATED USE net/http/httptest
  7. type TestRoundTripper struct {
  8. mock.Mock
  9. }
  10. // RoundTrip DEPRECATED USE net/http/httptest
  11. func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
  12. args := t.Called(req)
  13. return args.Get(0).(*http.Response), args.Error(1)
  14. }