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