Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exchange ¶
Exchange a type to store the request's method and URL and the response's status code
type TransportMonitor ¶
type TransportMonitor struct { Exchanges []Exchange // contains filtered or unexported fields }
TransportMonitor is a wrapper around the HTTP client's transport It collects usage stats of the request/responses, to be able to verify what how the HTTP client was actually used.
func NewTransportMonitor ¶
func NewTransportMonitor(t http.RoundTripper) *TransportMonitor
NewTransportMonitor returns a new Transport monitor
func (*TransportMonitor) RoundTrip ¶
RoundTrip implements the http.RoundTripper#RoundTrip(*http.Request) (*http.Response, error) function, It delegates the call to the underlying RoundTripper of this monitor, and keps track of the request/response exhanges data.
func (*TransportMonitor) ValidateExchanges ¶
func (t *TransportMonitor) ValidateExchanges(exchanges ...Exchange) error
ValidateExchanges verifies that the transport monitor contains the exact given sequence of exchanges
func (*TransportMonitor) ValidateNoExchanges ¶
func (t *TransportMonitor) ValidateNoExchanges() error
ValidateNoExchanges verifies that the transport monitor does not contain any record of exchanges