• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ThreeMammals / Ocelot / 26761608736

01 Jun 2026 02:34PM UTC coverage: 0.0% (-95.4%) from 95.403%
26761608736

Pull #2394

github

web-flow
Merge e39fc0db2 into e4022a7d8
Pull Request #2394: Harden `FileConfigurationPoller` against timer reentrancy and callback thread leaks, and stabilize `TimeoutDelegatingHandler` timeout test

0 of 7112 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/Ocelot/Responder/ErrorsToHttpStatusCodeMapper.cs
1
using Microsoft.AspNetCore.Http;
2
using Ocelot.Errors;
3

4
namespace Ocelot.Responder;
5

6
public class ErrorsToHttpStatusCodeMapper : IErrorsToHttpStatusCodeMapper
7
{
8
    public int Map(List<Error> errors)
9
    {
×
10
        if (errors.Any(e => e.Code == OcelotErrorCode.UnauthenticatedError))
×
11
        {
×
12
            return StatusCodes.Status401Unauthorized;
×
13
        }
14

15
        if (errors.Any(e => e.Code == OcelotErrorCode.UnauthorizedError
×
16
            || e.Code == OcelotErrorCode.ClaimValueNotAuthorizedError
×
17
            || e.Code == OcelotErrorCode.ScopeNotAuthorizedError
×
18
            || e.Code == OcelotErrorCode.UserDoesNotHaveClaimError
×
19
            || e.Code == OcelotErrorCode.CannotFindClaimError))
×
20
        {
×
21
            return StatusCodes.Status403Forbidden;
×
22
        }
23

24
        if (errors.Any(e => e.Code == OcelotErrorCode.QuotaExceededError))
×
25
        {
×
26
            return errors.Single(e => e.Code == OcelotErrorCode.QuotaExceededError).HttpStatusCode;
×
27
        }
28

29
        if (errors.Any(e => e.Code == OcelotErrorCode.RequestTimedOutError))
×
30
        {
×
31
            return StatusCodes.Status503ServiceUnavailable;
×
32
        }
33

34
        if (errors.Any(e => e.Code == OcelotErrorCode.RequestCanceled))
×
35
        {
×
36
            // status code refer to
37
            // https://stackoverflow.com/questions/46234679/what-is-the-correct-http-status-code-for-a-cancelled-request?answertab=votes#tab-top
38
            // https://httpstatuses.com/499
39
            return StatusCodes.Status499ClientClosedRequest;
×
40
        }
41

42
        if (errors.Any(e => e.Code == OcelotErrorCode.UnableToFindDownstreamRouteError))
×
43
        {
×
44
            return StatusCodes.Status404NotFound;
×
45
        }
46

47
        if (errors.Any(e => e.Code == OcelotErrorCode.ConnectionToDownstreamServiceError))
×
48
        {
×
49
            return StatusCodes.Status502BadGateway;
×
50
        }
51

52
        if (errors.Any(e => e.Code == OcelotErrorCode.UnableToCompleteRequestError
×
53
            || e.Code == OcelotErrorCode.CouldNotFindLoadBalancerCreator
×
54
            || e.Code == OcelotErrorCode.ErrorInvokingLoadBalancerCreator))
×
55
        {
×
56
            return StatusCodes.Status500InternalServerError;
×
57
        }
58

59
        if (errors.Any(e => e.Code == OcelotErrorCode.PayloadTooLargeError))
×
60
        {
×
61
            return StatusCodes.Status413PayloadTooLarge;
×
62
        }
63

64
        if (errors.Any(e => e.Code == OcelotErrorCode.BadRequestError))
×
65
        {
×
66
            return StatusCodes.Status400BadRequest;
×
67
        }
68

69
        return StatusCodes.Status404NotFound;
×
70
    }
×
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc