Documentation
¶
Overview ¶
Package vcr provides utilities for recording and replaying HTTP interactions in tests using go-vcr.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHTTPSClient ¶
GetHTTPSClient creates an HTTPS client for integration tests with VCR support. It wraps the HTTP client with VCR recording/replay based on VCR_MODE environment variable. The cassette name is automatically derived from t.Name(). In replay mode, a dummy API key is used. In record/off modes, BRAINTRUST_API_KEY is required.
func NewHTTPClient ¶
NewHTTPClient creates a new HTTP client with VCR support. If VCR_MODE=off, returns a standard HTTP client. The cassette name is automatically derived from t.Name().
func NewVCRRecorder ¶
NewVCRRecorder creates a new VCR recorder for the given cassette path. The recorder automatically scrubs sensitive headers before saving.
func WrapHTTPClient ¶
WrapHTTPClient wraps an existing http.Client with VCR recording/replay functionality. If VCR_MODE=off, returns the original client unchanged. The cassette name is automatically derived from t.Name(). Cassettes are stored in testdata/cassettes/<test-name>.yaml