mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
Develop (#338)
* #330 Fix and issue with the httpclient being cached on the url but not taking the http verb into accont. This caused an issue because if the same url but different verbs had handlers, the incorrect handler would be called * Amend so that UnableToCompleteRequestError returns 500 rather than 404. This error occur when a delegate handler throws an exception * Fix test that broke because of the change from 404 to 500 when delegate changes
This commit is contained in:
parent
e9106c30ee
commit
d2432cf7f7
@ -32,6 +32,11 @@ namespace Ocelot.Responder
|
|||||||
return 404;
|
return 404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errors.Any(e => e.Code == OcelotErrorCode.UnableToCompleteRequestError))
|
||||||
|
{
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
|
||||||
return 404;
|
return 404;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
.And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.NotFound))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.InternalServerError))
|
||||||
.BDDfy();
|
.BDDfy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,13 @@ namespace Ocelot.UnitTests.Responder
|
|||||||
ShouldMapErrorToStatusCode(errorCode, HttpStatusCode.ServiceUnavailable);
|
ShouldMapErrorToStatusCode(errorCode, HttpStatusCode.ServiceUnavailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(OcelotErrorCode.UnableToCompleteRequestError)]
|
||||||
|
public void should_return_internal_server_error(OcelotErrorCode errorCode)
|
||||||
|
{
|
||||||
|
ShouldMapErrorToStatusCode(errorCode, HttpStatusCode.InternalServerError);
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(OcelotErrorCode.CannotAddDataError)]
|
[InlineData(OcelotErrorCode.CannotAddDataError)]
|
||||||
[InlineData(OcelotErrorCode.CannotFindDataError)]
|
[InlineData(OcelotErrorCode.CannotFindDataError)]
|
||||||
@ -60,7 +67,6 @@ namespace Ocelot.UnitTests.Responder
|
|||||||
[InlineData(OcelotErrorCode.RateLimitOptionsError)]
|
[InlineData(OcelotErrorCode.RateLimitOptionsError)]
|
||||||
[InlineData(OcelotErrorCode.ServicesAreEmptyError)]
|
[InlineData(OcelotErrorCode.ServicesAreEmptyError)]
|
||||||
[InlineData(OcelotErrorCode.ServicesAreNullError)]
|
[InlineData(OcelotErrorCode.ServicesAreNullError)]
|
||||||
[InlineData(OcelotErrorCode.UnableToCompleteRequestError)]
|
|
||||||
[InlineData(OcelotErrorCode.UnableToCreateAuthenticationHandlerError)]
|
[InlineData(OcelotErrorCode.UnableToCreateAuthenticationHandlerError)]
|
||||||
[InlineData(OcelotErrorCode.UnableToFindDownstreamRouteError)]
|
[InlineData(OcelotErrorCode.UnableToFindDownstreamRouteError)]
|
||||||
[InlineData(OcelotErrorCode.UnableToFindLoadBalancerError)]
|
[InlineData(OcelotErrorCode.UnableToFindLoadBalancerError)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user