mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-24 10:22:13 +01:00
WithProxy
This commit is contained in:
@@ -30,11 +30,11 @@ namespace WireMock.Net.Console.NETCoreApp
|
|||||||
|
|
||||||
server
|
server
|
||||||
.Given(Request.Create().WithPath("/bbc").UsingGet())
|
.Given(Request.Create().WithPath("/bbc").UsingGet())
|
||||||
.RespondWith(Response.Create().FromProxyUrl("http://www.bbc.com"));
|
.RespondWith(Response.Create().WithProxy("http://www.bbc.com"));
|
||||||
|
|
||||||
server
|
server
|
||||||
.Given(Request.Create().WithPath("/google").UsingGet())
|
.Given(Request.Create().WithPath("/google").UsingGet())
|
||||||
.RespondWith(Response.Create().FromProxyUrl("http://www.google.com"));
|
.RespondWith(Response.Create().WithProxy("http://www.google.com"));
|
||||||
|
|
||||||
server
|
server
|
||||||
.Given(Request.Create().WithPath(p => p.Contains("x")).UsingGet())
|
.Given(Request.Create().WithPath(p => p.Contains("x")).UsingGet())
|
||||||
|
|||||||
@@ -12,6 +12,6 @@ namespace WireMock.ResponseBuilders
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="proxyUrl">The proxy url.</param>
|
/// <param name="proxyUrl">The proxy url.</param>
|
||||||
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
||||||
IResponseBuilder FromProxyUrl([NotNull] string proxyUrl);
|
IResponseBuilder WithProxy([NotNull] string proxyUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ namespace WireMock.ResponseBuilders
|
|||||||
/// <param name="proxyUrl">The proxy url.</param>
|
/// <param name="proxyUrl">The proxy url.</param>
|
||||||
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public IResponseBuilder FromProxyUrl(string proxyUrl)
|
public IResponseBuilder WithProxy(string proxyUrl)
|
||||||
{
|
{
|
||||||
Check.NotEmpty(proxyUrl, nameof(proxyUrl));
|
Check.NotEmpty(proxyUrl, nameof(proxyUrl));
|
||||||
|
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ namespace WireMock.Server
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(responseModel.ProxyUrl))
|
if (!string.IsNullOrEmpty(responseModel.ProxyUrl))
|
||||||
{
|
{
|
||||||
return responseBuilder.FromProxyUrl(responseModel.ProxyUrl);
|
return responseBuilder.WithProxy(responseModel.ProxyUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseModel.StatusCode.HasValue)
|
if (responseModel.StatusCode.HasValue)
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ namespace WireMock.Net.Tests
|
|||||||
_server = FluentMockServer.Start();
|
_server = FluentMockServer.Start();
|
||||||
_server
|
_server
|
||||||
.Given(Request.Create().WithPath("/*"))
|
.Given(Request.Create().WithPath("/*"))
|
||||||
.RespondWith(Response.Create().FromProxyUrl("http://www.google.com"));
|
.RespondWith(Response.Create().WithProxy("http://www.google.com"));
|
||||||
|
|
||||||
// when
|
// when
|
||||||
var result = await new HttpClient().GetStringAsync("http://localhost:" + _server.Ports[0] + "/foo");
|
var result = await new HttpClient().GetStringAsync("http://localhost:" + _server.Ports[0] + "/foo");
|
||||||
|
|||||||
Reference in New Issue
Block a user