Update standalone commandline parsing (#27)

This commit is contained in:
Stef Heyenrath
2017-05-13 10:10:17 +02:00
parent 4ada6d3567
commit 961e8b555f
11 changed files with 85 additions and 31 deletions

View File

@@ -120,18 +120,21 @@ namespace WireMock.Server
Given(Request.Create().WithPath(AdminRequests + "/find").UsingPost()).RespondWith(new DynamicResponseProvider(RequestsFind));
}
#region Proxy and Record
private void InitProxyAndRecord(ProxyAndRecordSettings settings)
{
Given(Request.Create().WithPath("/*").UsingAnyVerb()).RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings));
}
#region Proxy and Record
private async Task<ResponseMessage> ProxyAndRecordAsync(RequestMessage requestMessage, ProxyAndRecordSettings settings)
{
var responseMessage = await HttpClientHelper.SendAsync(requestMessage, settings.Url);
var mapping = ToMapping(requestMessage, responseMessage);
SaveMappingToFile(mapping);
if (settings.SaveMapping)
{
var mapping = ToMapping(requestMessage, responseMessage);
SaveMappingToFile(mapping);
}
return responseMessage;
}