Add WebProxySettings (use when proxying requests) (#370)

* webproxy part 1

* fixed

* Push to MyGet

* WebProxy standalone

* -n true

* nuget --- "-n true"

* AllowAutoRedirect

* .
This commit is contained in:
Stef Heyenrath
2019-12-07 08:52:04 +01:00
committed by GitHub
parent 8bafd6a1ba
commit 1b326a54d6
16 changed files with 266 additions and 51 deletions

View File

@@ -2,6 +2,7 @@
using NFluent;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using WireMock.Models;
using WireMock.RequestBuilders;
@@ -45,6 +46,28 @@ namespace WireMock.Net.Tests.ResponseBuilders
Check.That(responseMessage.Headers["Content-Type"].ToString()).IsEqualTo("application/json");
}
[Fact]
public void Response_WithProxy_WebProxySettings()
{
// Assign
var settings = new ProxyAndRecordSettings
{
Url = "http://test.nl",
WebProxySettings = new WebProxySettings
{
Address = "http://company",
UserName = "x",
Password = "y"
}
};
var response = Response.Create().WithProxy(settings);
// Act
var request = new RequestMessage(new UrlDetails($"{_server.Urls[0]}/{_guid}"), "GET", "::1");
Check.ThatAsyncCode(() => response.ProvideResponseAsync(request, _settingsMock.Object)).Throws<HttpRequestException>();
}
public void Dispose()
{
_server?.Dispose();