Fix proxy headers handling (#60)

* Fix proxy headers handling

* Small refactor and moved proxy tests to new test-file.
This commit is contained in:
Oleksandr Liakhevych
2017-10-28 19:59:34 +03:00
committed by Stef Heyenrath
parent d134684bcb
commit c8c9ab99c5
9 changed files with 248 additions and 134 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using JetBrains.Annotations;
@@ -129,8 +130,11 @@ namespace WireMock.Server
}
#region Proxy and Record
private HttpClient httpClientForProxy;
private void InitProxyAndRecord(ProxyAndRecordSettings settings)
{
httpClientForProxy = HttpClientHelper.CreateHttpClient(settings.X509Certificate2ThumbprintOrSubjectName);
Given(Request.Create().WithPath("/*").UsingAnyVerb()).RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings));
}
@@ -140,7 +144,7 @@ namespace WireMock.Server
var proxyUri = new Uri(settings.Url);
var proxyUriWithRequestPathAndQuery = new Uri(proxyUri, requestUri.PathAndQuery);
var responseMessage = await HttpClientHelper.SendAsync(requestMessage, proxyUriWithRequestPathAndQuery.AbsoluteUri, settings.X509Certificate2ThumbprintOrSubjectName);
var responseMessage = await HttpClientHelper.SendAsync(httpClientForProxy, requestMessage, proxyUriWithRequestPathAndQuery.AbsoluteUri);
if (settings.SaveMapping)
{