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

ThreeMammals / Ocelot / 36707038946

30 Sep 2026 11:11AM UTC coverage: 97.127% (-0.5%) from 97.638%
36707038946

push

github

web-flow
#2352 Stop building upstream header templates from request headers in dynamic routing (#2427)

* #2352 Add tests reproducing RegexParseException for browser headers in dynamic routing
* #2352 Stop building upstream header templates from request headers in dynamic routing
* Update scripting in workflows related to code coverage copying the version from develop
* Code review by @raman-m
* Enable builds for release/25.0 branch
---------
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>

6728 of 6927 relevant lines covered (97.13%)

3289.59 hits per line

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

80.0
src/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>())
7 ✔
16
    {
7 ✔
17
        _next = next;
7 ✔
18
        _addQueriesToRequest = addQueriesToRequest;
7 ✔
19
    }
7 ✔
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 TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc