Closed tb-x closed 4 years ago
Thanks for reporting this issue! About your questions:
1- You are right. I'll make the change.
2- The recording can be modified by creating a custom ICassetteStorage
:
public class CustomStorage : ICassetteStorage
{
private FileSystemCassetteStorage _storage;
public CustomStorage(DirectoryInfo dir)
{
_storage = new FileSystemCassetteStorage(dir);
}
public void Save(string name, IEnumerable<HttpInteraction> httpInteractions)
{
//modify httpInteractions at will, then delegate to the default storage impl for actual storage
_storage.Save(name, httpInteractions);
}
...
}
Then from your test replace this line with the custom storage implementation: https://github.com/epignosisx/vcr.net/blob/master/sample/SampleWebApp.IntegrationTest/HomeControllerTest.cs#L22
@tb-x I published version 0.1.3 to Nuget. Should be shortly listed.
In my test case, I'm trying to use the
RecordMode.Once
to record the cassettes in the first run and then replay the payloads during consecutive runs. The API that I'm recording is using API key authentication in headers. I don't want to store the API Key in a cassette in source control and I don't want to compare this header during playbacks.I tried to use the
IgnoreHeaders
property ofDefaultRequestMatcher
but it is not used during the recording (which conceptually makes sense for your design). On the other hand, when replaying, theIgnoreHeaders
seems to be used as a blacklist, but it should be a whitelist for comparison.should be: