Make SaveMapping and SaveMappingToFile settings independent. (#317)

When both are true - mappings are applied instantly and may affect further requests recording.
This commit is contained in:
Vitaliy Davydiak
2019-08-16 09:15:46 +03:00
committed by Stef Heyenrath
parent 6ee4a42f0a
commit 4bfd72cdc3

View File

@@ -266,10 +266,14 @@ namespace WireMock.Server
var responseMessage = await HttpClientHelper.SendAsync(_httpClientForProxy, requestMessage, proxyUriWithRequestPathAndQuery.AbsoluteUri);
if (settings.ProxyAndRecordSettings.SaveMapping)
if (settings.ProxyAndRecordSettings.SaveMapping || settings.ProxyAndRecordSettings.SaveMappingToFile)
{
var mapping = ToMapping(requestMessage, responseMessage, settings.ProxyAndRecordSettings.BlackListedHeaders ?? new string[] { });
_options.Mappings.TryAdd(mapping.Guid, mapping);
if (settings.ProxyAndRecordSettings.SaveMapping)
{
_options.Mappings.TryAdd(mapping.Guid, mapping);
}
if (settings.ProxyAndRecordSettings.SaveMappingToFile)
{