• 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

94.12
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)
10✔
15
    {
10✔
16
        _claimsParser = claimsParser;
10✔
17
    }
10✔
18

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

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

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

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

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

44
        downstreamRequest.Query = ConvertDictionaryToQueryString(queryDictionary);
3✔
45

46
        return new OkResponse();
3✔
47
    }
4✔
48

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

54
        return query;
4✔
55
    }
4✔
56

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

61
        builder.Append('?');
3✔
62

63
        var outerCount = 0;
3✔
64

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

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

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

82
            outerCount++;
6✔
83
        }
6✔
84

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