testutils

package
v0.0.0-...-e61e643 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRoundTripper

func NewRoundTripper(roundTrip func(*http.Request) (*http.Response, error)) http.RoundTripper

NewRoundTripper returns a new RoundTripper which will call the provided function.

Types

type MockTransport

type MockTransport struct {
	// RT is the RoundTrip function. Replace this function with your test function.
	// For example:
	//   t := MockTransport{}
	//   t.RT = func(req *http.Request) (*http.Response, error) {
	//       // assert req args, return res or error
	//   }
	RT func(*http.Request) (*http.Response, error)
}

MockTransport implements RoundTripper

func (MockTransport) RoundTrip

func (t MockTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip is a RoundTripper

Jump to

Keyboard shortcuts

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