cv / tv

Load and replay VCR cassettes with ease
MIT License
1 stars 1 forks source link

Less strict matching #1

Open maxlinc opened 11 years ago

maxlinc commented 11 years ago

Right now TV expects responses to be an exact match. This limits its usefulness compared to finding a semantic match. The HTTP Date header is a simple example. If it is used and recorded, then TV will never match the response, because the cassette contains a date in the past and the actual response contains the current date. Semantically these are equivalent - they are the date at the time of the request.

There are many other examples that are probably always semantically equivalent, as well as some things that some people may be considered semantically equivalent for some tests but not others - like Via, Age, Expires, Connection (keep-alive vs closed), etc.

cv commented 11 years ago

Would this be best solved by adding a header filter?

maxlinc commented 11 years ago

Its not necessarily just headers. Response bodies may also contain dates or other transient fields.

I think its best solved by either: Hooks to modify interactions (similar to VCR hooks) Or Overriding the matcher (let TV do the cassette management and playback, but let the caller do the comparison)

Or both ;-)