vcr

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const UpdateCassettesEnvVariable = "PACKER_UPDATE_CASSETTES"

Variables

View Source
var QueryMatcherIgnore = []string{
	"project_id",
	"project",
}

QueryMatcherIgnore is a list of query parameters that should be ignored when matching cassettes requests

View Source
var UpdateCassettes = os.Getenv(UpdateCassettesEnvVariable) == "true"

Functions

func GetHTTPRecorder

func GetHTTPRecorder(cassetteFilePath string, update bool) (client *http.Client, cleanup func(), err error)

GetHTTPRecorder creates a new httpClient that records all HTTP requests in a cassette. This cassette is then replayed whenever tests are executed again. This means that once the requests are recorded in the cassette, no more real HTTP requests must be made to run the tests.

It is important to add a `defer cleanup()` so the given cassette files are correctly closed and saved after the requests.

func GetTestFilePath

func GetTestFilePath(t *testing.T, pkgFolder string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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