Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom interaction matching. #11

Merged
merged 2 commits into from
Jun 2, 2016
Merged

Add custom interaction matching. #11

merged 2 commits into from
Jun 2, 2016

Conversation

brentdrich
Copy link
Contributor

Interactions (recorded request/response pairs) were only matched
according to request method and URL during replay. This limits
the usefulness of go-vcr for testing HTTP requests because the
interesting state is often in the headers or body. For example, a
idiomatic PUT action in a REST API may have the same URL but respond
differently based on the body.

This PR matches requests to interactions using a Matcher function.
Users of the go-vcr library can define and use custom matchers in
their tests by setting the matcher on the recorder with SetMatcher.

Interactions (recorded request/response pairs) were only matched
according to request method and URL during replay. This limits
the usefulness of go-vcr for testing HTTP requests because the
interesting state is often in the headers or body. For example, a
idiomatic PUT action in a REST API may have the same URL but respond
differently based on the body.

This commit matches requests to interactions using a Matcher function.
Users of the go-vcr library can define and use custom matchers in
their tests by setting the matcher on the recorder with SetMatcher.
Since the recorder package imports cassette, the import paths were
changed to another fork for testing. This commit restores the imports
to the original repository for a cleaner merge.
@dnaeon dnaeon merged commit 9d71b8a into dnaeon:master Jun 2, 2016
@dnaeon
Copy link
Owner

dnaeon commented Jun 2, 2016

Thanks!

dougnukem pushed a commit to dougnukem/go-vcr that referenced this pull request Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants