mock

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL