mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-18 23:38:16 +08:00
Change HttpStatusCodeMapper not to wrap responses
As part of #66 we realised that the implementation of IErrorToHttpStatusCodeMapper would always return a wrapped StatusCode within an OK response, in turn meaning that ResponderMiddleware would never fall into the else branch for returning a 500. This commit removes the wrapping of the status code and removes the unused logic for generating the 500 status code, giving the mapper full responsbility for generating the correct status code.
This commit is contained in:
@ -4,7 +4,6 @@ using Ocelot.Errors;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Requester;
|
||||
using Ocelot.Responder;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
@ -14,7 +13,7 @@ namespace Ocelot.UnitTests.Responder
|
||||
public class ErrorsToHttpStatusCodeMapperTests
|
||||
{
|
||||
private readonly IErrorsToHttpStatusCodeMapper _codeMapper;
|
||||
private Response<int> _result;
|
||||
private int _result;
|
||||
private List<Error> _errors;
|
||||
|
||||
public ErrorsToHttpStatusCodeMapperTests()
|
||||
@ -77,7 +76,7 @@ namespace Ocelot.UnitTests.Responder
|
||||
|
||||
private void ThenTheResponseIsStatusCodeIs(int expectedCode)
|
||||
{
|
||||
_result.Data.ShouldBe(expectedCode);
|
||||
_result.ShouldBe(expectedCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user