Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient provides a simple way of setting up mocks for requests to an HTTP. The mocking is done by providing a RoundTripper implementation that intercepts the requests to HTTP service, passes them through a gorilla.Mux, and returns the response. The gorilla.Mux allows callers to conveniently set up mocked responses for a given HTTP endpoint.
func NewHTTPClient ¶
func NewHTTPClient() *HTTPClient
NewHTTPClient returns an HTTPClient with no routes defined.
func (*HTTPClient) Client ¶
func (hc *HTTPClient) Client() *http.Client
Client returns the mocked HTTP Client instance.
func (*HTTPClient) Mock ¶
func (hc *HTTPClient) Mock(method, path string, handler http.HandlerFunc) *HTTPClient
Mock registers an HTTP handler for the provided method and path.
Click to show internal directories.
Click to hide internal directories.