Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientPatcher ¶
type ClientPatcher struct { OriginalTransport http.RoundTripper MockTransport http.RoundTripper // contains filtered or unexported fields }
ClientPatcher is a helper structure which will contains the client will be patched, the original transport and mock transport.
func PatchClient ¶
func PatchClient(httpClient *http.Client, targetServers ...*TargetServer) *ClientPatcher
PatchClient will replace the original transport with mock transport. It will return ClientPatcher for remove the mock transport after using it.
func (*ClientPatcher) RemovePatch ¶
func (httpReq *ClientPatcher) RemovePatch()
RemovePatch will replace the mock transport with original.
type ResponseHandler ¶
ResponseHandler contains a mock response and a request should be handled.
type TargetServer ¶
type TargetServer struct { Host string ResponseHandlers []*ResponseHandler }
func NewTargetServer ¶
func NewTargetServer(host string) *TargetServer
NetTargetServer will returns TargetServer with the host.
func (*TargetServer) AddResponseHandler ¶
func (s *TargetServer) AddResponseHandler(r *ResponseHandler) *TargetServer
AddResponseHandler will add ResponseHandler to the TargetServer.
Click to show internal directories.
Click to hide internal directories.