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

ThreeMammals / Ocelot / 23300941776

19 Mar 2026 02:52PM UTC coverage: 91.208% (-1.3%) from 92.49%
23300941776

Pull #2369

github

web-flow
Merge 70cf22f1d into 086c7b15c
Pull Request #2369: Pre-Release 25.0 aka Beta 2

8403 of 9213 relevant lines covered (91.21%)

2745.84 hits per line

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

80.0
src/Ocelot/QueryStrings/ClaimsToQueryStringMiddleware.cs
1
using Microsoft.AspNetCore.Http;
2
using Ocelot.Logging;
3
using Ocelot.Middleware;
4

5
namespace Ocelot.QueryStrings;
6

7
public class ClaimsToQueryStringMiddleware : OcelotMiddleware
8
{
9
    private readonly RequestDelegate _next;
10
    private readonly IAddQueriesToRequest _addQueriesToRequest;
11

12
    public ClaimsToQueryStringMiddleware(RequestDelegate next,
13
        IOcelotLoggerFactory loggerFactory,
14
        IAddQueriesToRequest addQueriesToRequest)
15
            : base(loggerFactory.CreateLogger<ClaimsToQueryStringMiddleware>())
3✔
16
    {
3✔
17
        _next = next;
3✔
18
        _addQueriesToRequest = addQueriesToRequest;
3✔
19
    }
3✔
20

21
    public async Task Invoke(HttpContext httpContext)
22
    {
1✔
23
        var downstreamRoute = httpContext.Items.DownstreamRoute();
1✔
24

25
        if (downstreamRoute.ClaimsToQueries.Any())
1✔
26
        {
1✔
27
            Logger.LogInformation(() => $"{downstreamRoute.DownstreamPathTemplate.Value} has instructions to convert claims to queries");
1✔
28

29
            var downstreamRequest = httpContext.Items.DownstreamRequest();
1✔
30

31
            var response = _addQueriesToRequest.SetQueriesOnDownstreamRequest(downstreamRoute.ClaimsToQueries, httpContext.User.Claims, downstreamRequest);
1✔
32

33
            if (response.IsError)
1✔
34
            {
×
35
                Logger.LogWarning("there was an error setting queries on context, setting pipeline error");
×
36

37
                httpContext.Items.UpsertErrors(response.Errors);
×
38
                return;
×
39
            }
40
        }
1✔
41

42
        await _next.Invoke(httpContext);
1✔
43
    }
1✔
44
}
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