merged publish fix

This commit is contained in:
Tom Gardham-Pallister
2017-10-13 08:28:38 +01:00
6 changed files with 76 additions and 25 deletions

View File

@ -98,7 +98,7 @@ namespace Ocelot.AcceptanceTests
DownstreamScheme = "http",
DownstreamHost = "localhost",
DownstreamPort = 51880,
UpstreamPathTemplate = "working",
UpstreamPathTemplate = "/working",
UpstreamHttpMethod = new List<string> { "Get" },
}
}

View File

@ -443,6 +443,46 @@ namespace Ocelot.AcceptanceTests
.BDDfy();
}
[Fact]
public void should_return_404_when_calling_upstream_route_with_no_matching_downstream_re_route_github_issue_134()
{
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
{
new FileReRoute
{
DownstreamPathTemplate = "/api/v1/vacancy",
DownstreamScheme = "http",
DownstreamHost = "localhost",
DownstreamPort = 51879,
UpstreamPathTemplate = "/vacancy/",
UpstreamHttpMethod = new List<string> { "Options", "Put", "Get", "Post", "Delete" },
ServiceName = "botCore",
LoadBalancer = "LeastConnection"
},
new FileReRoute
{
DownstreamPathTemplate = "/api/v1/vacancy/{vacancyId}",
DownstreamScheme = "http",
DownstreamHost = "localhost",
DownstreamPort = 51879,
UpstreamPathTemplate = "/vacancy/{vacancyId}",
UpstreamHttpMethod = new List<string> { "Options", "Put", "Get", "Post", "Delete" },
ServiceName = "botCore",
LoadBalancer = "LeastConnection"
}
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879/api/v1/vacancy/1", 200, "Hello from Laura"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("api/vacancy/1"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.NotFound))
.BDDfy();
}
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
{
_builder = new WebHostBuilder()
@ -453,7 +493,7 @@ namespace Ocelot.AcceptanceTests
.Configure(app =>
{
app.Run(async context =>
{
{
_downstreamPath = context.Request.PathBase.Value;
context.Response.StatusCode = statusCode;
await context.Response.WriteAsync(responseBody);