Do not save Mappings when SaveMappingForStatusCodePattern does not match (#566)

This commit is contained in:
Stef Heyenrath
2021-01-24 12:30:59 +01:00
committed by GitHub
parent e8181e9d53
commit c41989c0f3
2 changed files with 45 additions and 6 deletions

View File

@@ -261,14 +261,17 @@ namespace WireMock.Server
proxyUriWithRequestPathAndQuery.AbsoluteUri
);
if (settings.ProxyAndRecordSettings.SaveMapping)
if (mapping != null)
{
_options.Mappings.TryAdd(mapping.Guid, mapping);
}
if (settings.ProxyAndRecordSettings.SaveMapping)
{
_options.Mappings.TryAdd(mapping.Guid, mapping);
}
if (settings.ProxyAndRecordSettings.SaveMappingToFile)
{
_mappingToFileSaver.SaveMappingToFile(mapping);
if (settings.ProxyAndRecordSettings.SaveMappingToFile)
{
_mappingToFileSaver.SaveMappingToFile(mapping);
}
}
return responseMessage;