Initial code for proxy and record #27

This commit is contained in:
Stef Heyenrath
2017-05-09 21:43:10 +02:00
parent b25371cf15
commit 31261ec45d
14 changed files with 160 additions and 10 deletions

View File

@@ -16,6 +16,9 @@ using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Util;
using WireMock.Validation;
using WireMock.Http;
using System.Threading.Tasks;
using WireMock.Settings;
namespace WireMock.Server
{
@@ -117,6 +120,20 @@ namespace WireMock.Server
Given(Request.Create().WithPath(AdminRequests + "/find").UsingPost()).RespondWith(new DynamicResponseProvider(RequestsFind));
}
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);
return responseMessage;
}
#endregion
#region Settings
private ResponseMessage SettingsGet(RequestMessage requestMessage)
{