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

ThreeMammals / Ocelot / 26241073880

21 May 2026 05:06PM UTC coverage: 95.327% (+0.6%) from 94.721%
26241073880

push

github

raman-m
Ref SDK 10.0.300 (Runtime 10.0.8) to release Ocelot v25 beta 3 and Ocelot.Testing v25 beta 8+ (#2389)

* Prepare to release Ocelot.Testing v25.0.0-beta.8 package
* Bump all packages to the latest versions, including .NET SDK 10.0.203 (Runtime 10.0.7) released April 21, 2026
* Migrate unit testing from VSTest framework to Microsoft.Testing.Platform
* Do not use 'Cake Build' step in PR workflow, use plain dotnet scripting instead
* Fix "Unit Tests" step in PR workflow
* Rename job to "build" since it's not Cake anymore
* Suppress non-zero result and check test running status
* Update "Acceptance Tests" step
* Don't collect Coverlet code coverage data in "Acceptance Tests" step
* Update prepare-coveralls.sh
* Prepare Coveralls script v2
* Prepare Coveralls script v3
* Prepare Coveralls script v4
* Prepare Coveralls script v5 -> Add 2nd BUILD_CONFIGURATION argument
* Upgrade to SDK 10.0.300 aka Runtime 10.0.8
* Update samples
* Update workflows: prefer plain dotnet scripting over Cake Build

6752 of 7083 relevant lines covered (95.33%)

2730.81 hits per line

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

89.74
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
    {
38✔
10
        if (errors.Any(e => e.Code == OcelotErrorCode.UnauthenticatedError))
38✔
11
        {
2✔
12
            return StatusCodes.Status401Unauthorized;
2✔
13
        }
14

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

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

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

34
        if (errors.Any(e => e.Code == OcelotErrorCode.RequestCanceled))
28✔
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))
28✔
43
        {
1✔
44
            return StatusCodes.Status404NotFound;
1✔
45
        }
46

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

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

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

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

69
        return StatusCodes.Status404NotFound;
21✔
70
    }
38✔
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