mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 18:48:15 +08:00
Merge branch 'feature/603-bad-gateway' of https://github.com/jlukawska/Ocelot into jlukawska-feature/603-bad-gateway
This commit is contained in:
@ -141,7 +141,7 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_500_when_using_http_one_to_talk_to_server_running_http_two()
|
||||
public void should_return_response_502_when_using_http_one_to_talk_to_server_running_http_two()
|
||||
{
|
||||
var port = RandomPortFinder.GetRandomPort();
|
||||
|
||||
@ -177,7 +177,7 @@ namespace Ocelot.AcceptanceTests
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/", httpContent))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.InternalServerError))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.BadGateway))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,38 @@
|
||||
{
|
||||
_serviceHandler = new ServiceHandler();
|
||||
_steps = new Steps();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_bad_gateway_error_if_downstream_service_doesnt_respond()
|
||||
{
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = new List<string> { "Get" },
|
||||
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||
{
|
||||
new FileHostAndPort
|
||||
{
|
||||
Host = "localhost",
|
||||
Port = 53877,
|
||||
},
|
||||
},
|
||||
DownstreamScheme = "http",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
this.Given(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.BadGateway))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -89,7 +89,7 @@ namespace Ocelot.AcceptanceTests
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.InternalServerError))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.BadGateway))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user