ooni-probe-cli/internal/netxlite/mocks/http3.go
Simone Basso 493b72b170
refactor(netxlite): improve tests for http and http3 (#487)
* refactor(netxlite): improve tests for http and http3

See https://github.com/ooni/probe/issues/1591

* Update internal/netxlite/http3.go
2021-09-08 00:59:48 +02:00

20 lines
467 B
Go

package mocks
import "net/http"
// HTTP3RoundTripper allows mocking http3.RoundTripper.
type HTTP3RoundTripper struct {
MockRoundTrip func(req *http.Request) (*http.Response, error)
MockClose func() error
}
// RoundTrip calls MockRoundTrip.
func (txp *HTTP3RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
return txp.MockRoundTrip(req)
}
// Close calls MockClose.
func (txp *HTTP3RoundTripper) Close() error {
return txp.MockClose()
}