Documentation
¶
Overview ¶
Package httptest provides utilities for HTTP testing. It includes helpers for the VCR library we use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTransportRecorder ¶
func NewTransportRecorder( t testing.TB, name string, opts TransportRecorderOptions, ) *recorder.Recorder
NewTransportRecorder builds a new HTTP request recorder/replayer that will write fixtures to testdata/fixtures/<name>.
The returned Recorder will be in recording mode if the -update flag is set, and in replay mode otherwise.
Types ¶
type TransportRecorderOptions ¶
type TransportRecorderOptions struct { // Update specifies whether the Recorder should update fixtures. // // If unset, we will assume false. Update *bool // WrapRealTransport wraps the real HTTP transport // with the given function. // // This is called only in update mode. WrapRealTransport func( t testing.TB, transport http.RoundTripper, ) http.RoundTripper Matcher func(*http.Request, cassette.Request) bool }
TransportRecorderOptions contains options for creating a new [TransportRecorder].
Click to show internal directories.
Click to hide internal directories.