• 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/QueryStrings/AddQueriesToRequest.cs
1
using Microsoft.Extensions.Primitives;
2
using Ocelot.Configuration;
3
using Ocelot.Infrastructure.Claims;
4
using Ocelot.Request.Middleware;
5
using Ocelot.Responses;
6
using System.Security.Claims;
7

8
namespace Ocelot.QueryStrings;
9

10
public class AddQueriesToRequest : IAddQueriesToRequest
11
{
12
    private readonly IClaimsParser _claimsParser;
13

14
    public AddQueriesToRequest(IClaimsParser claimsParser)
×
15
    {
×
16
        _claimsParser = claimsParser;
×
17
    }
×
18

19
    public Response SetQueriesOnDownstreamRequest(List<ClaimToThing> claimsToThings, IEnumerable<Claim> claims, DownstreamRequest downstreamRequest)
20
    {
×
21
        var queryDictionary = ConvertQueryStringToDictionary(downstreamRequest.Query);
×
22

23
        foreach (var config in claimsToThings)
×
24
        {
×
25
            var value = _claimsParser.GetValue(claims, config.NewKey, config.Delimiter, config.Index);
×
26

27
            if (value.IsError)
×
28
            {
×
29
                return new ErrorResponse(value.Errors);
×
30
            }
31

32
            var exists = queryDictionary.FirstOrDefault(x => x.Key == config.ExistingKey);
×
33

34
            if (!string.IsNullOrEmpty(exists.Key))
×
35
            {
×
36
                queryDictionary[exists.Key] = value.Data;
×
37
            }
×
38
            else
39
            {
×
40
                queryDictionary.Add(config.ExistingKey, value.Data);
×
41
            }
×
42
        }
×
43

44
        downstreamRequest.Query = ConvertDictionaryToQueryString(queryDictionary);
×
45

46
        return new OkResponse();
×
47
    }
×
48

49
    private static Dictionary<string, StringValues> ConvertQueryStringToDictionary(string queryString)
50
    {
×
51
        var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers
×
52
            .ParseQuery(queryString);
×
53

54
        return query;
×
55
    }
×
56

57
    private static string ConvertDictionaryToQueryString(Dictionary<string, StringValues> queryDictionary)
58
    {
×
59
        var builder = new StringBuilder();
×
60

61
        builder.Append('?');
×
62

63
        var outerCount = 0;
×
64

65
        foreach (var query in queryDictionary)
×
66
        {
×
67
            for (var innerCount = 0; innerCount < query.Value.Count; innerCount++)
×
68
            {
×
69
                builder.Append($"{query.Key}={query.Value[innerCount]}");
×
70

71
                if (innerCount < (query.Value.Count - 1))
×
72
                {
×
73
                    builder.Append('&');
×
74
                }
×
75
            }
×
76

77
            if (outerCount < (queryDictionary.Count - 1))
×
78
            {
×
79
                builder.Append('&');
×
80
            }
×
81

82
            outerCount++;
×
83
        }
×
84

85
        return builder.ToString();
×
86
    }
×
87
}
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