mocks

package
v0.0.0-...-1dd80fa Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

type MockClient struct {
	DoFunc func(req *http.Request) (*http.Response, error)
}

MockClient is a mock of a HttpClient, used to return a predetermined response for testing. DoFunc is the function that is executed when the Do-method is called on the MockClient. If no DoFunc is set for the MockClient, the MockClient returns a standard 200-response

func (*MockClient) Do

func (m *MockClient) Do(req *http.Request) (*http.Response, error)

Do "executes" the request passed to it. If the DoFunc is set, it executes the DoFunc with the request as a argument. Otherwise it returns a 200-response.

Jump to

Keyboard shortcuts

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