testing

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeResponse added in v0.7.0

type FakeResponse struct {
	Err  error
	Code int
	Body string
}

FakeResponse is a response given by the FakeRoundTripper

type FakeRoundTripper added in v0.7.0

type FakeRoundTripper struct {
	// Return an error if host header does not match this
	ExpectHost string

	// LockerCh blocks responses being sent until a struct is written to the channel
	LockerCh chan struct{}

	// ProbeHostResponses are popped when a probe request is made to a given host. If
	// no host is matched then this falls back to the behavior or ProbeResponses
	ProbeHostResponses map[string][]FakeResponse

	// Responses to probe requests are popeed from this list until it is size 1 then
	// that response is returned indefinitely
	ProbeResponses []FakeResponse

	// Response to non-probe requests
	RequestResponse *FakeResponse

	NumProbes int32
	// contains filtered or unexported fields
}

FakeRoundTripper is a roundtripper emulator useful in testing

func (*FakeRoundTripper) RT added in v0.7.0

func (rt *FakeRoundTripper) RT(req *http.Request) (*http.Response, error)

RT is a RoundTripperFunc

Jump to

Keyboard shortcuts

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