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

ThreeMammals / Ocelot / 23302213965

19 Mar 2026 03:19PM UTC coverage: 91.219% (-1.3%) from 92.49%
23302213965

Pull #2369

github

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

8404 of 9213 relevant lines covered (91.22%)

2131.48 hits per line

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

91.84
src/Ocelot/Middleware/HttpItemsExtensions.cs
1
using Ocelot.Configuration;
2
using Ocelot.DownstreamRouteFinder.UrlMatcher;
3
using Ocelot.Errors;
4
using Ocelot.Request.Middleware;
5

6
namespace Ocelot.Middleware;
7

8
public static class HttpItemsExtensions
9
{
10
    public static void UpsertDownstreamRequest(this IDictionary<object, object> input, DownstreamRequest downstreamRequest)
11
    {
233✔
12
        input.Upsert("DownstreamRequest", downstreamRequest);
233✔
13
    }
233✔
14

15
    public static void UpsertDownstreamResponse(this IDictionary<object, object> input, DownstreamResponse downstreamResponse)
16
    {
42✔
17
        input.Upsert("DownstreamResponse", downstreamResponse);
42✔
18
    }
42✔
19

20
    public static void UpsertDownstreamRoute(this IDictionary<object, object> input, DownstreamRoute downstreamRoute)
21
    {
305✔
22
        input.Upsert("DownstreamRoute", downstreamRoute);
305✔
23
    }
305✔
24

25
    public static void UpsertTemplatePlaceholderNameAndValues(this IDictionary<object, object> input, List<PlaceholderNameAndValue> tPNV)
26
    {
224✔
27
        input.Upsert("TemplatePlaceholderNameAndValues", tPNV);
224✔
28
    }
224✔
29

30
    public static void UpsertDownstreamRoute(this IDictionary<object, object> input, DownstreamRouteFinder.DownstreamRouteHolder downstreamRoute)
31
    {
145✔
32
        input.Upsert("DownstreamRouteHolder", downstreamRoute);
145✔
33
    }
145✔
34

35
    public static void UpsertErrors(this IDictionary<object, object> input, List<Error> errors)
36
    {
8✔
37
        input.Upsert("Errors", errors);
8✔
38
    }
8✔
39

40
    public static void SetError(this IDictionary<object, object> input, Error error)
41
    {
13✔
42
        var errors = new List<Error> { error };
13✔
43
        input.Upsert("Errors", errors);
13✔
44
    }
13✔
45

46
    public static void SetIInternalConfiguration(this IDictionary<object, object> input, IInternalConfiguration config)
47
    {
80✔
48
        input.Upsert("IInternalConfiguration", config);
80✔
49
    }
80✔
50

51
    public static IInternalConfiguration IInternalConfiguration(this IDictionary<object, object> input)
52
    {
86✔
53
        return input.Get<IInternalConfiguration>("IInternalConfiguration");
86✔
54
    }
86✔
55

56
    public static List<Error> Errors(this IDictionary<object, object> input)
57
    {
148✔
58
        var errors = input.Get<List<Error>>("Errors");
148✔
59
        return errors ?? new();
148✔
60
    }
148✔
61

62
    public static DownstreamRouteFinder.DownstreamRouteHolder
63
        DownstreamRouteHolder(this IDictionary<object, object> input) =>
64
        input.Get<DownstreamRouteFinder.DownstreamRouteHolder>("DownstreamRouteHolder");
19✔
65

66
    public static List<PlaceholderNameAndValue>
67
        TemplatePlaceholderNameAndValues(this IDictionary<object, object> input) =>
68
        input.Get<List<PlaceholderNameAndValue>>("TemplatePlaceholderNameAndValues");
79✔
69

70
    public static DownstreamRequest DownstreamRequest(this IDictionary<object, object> input) =>
71
        input.Get<DownstreamRequest>("DownstreamRequest");
164✔
72

73
    public static DownstreamResponse DownstreamResponse(this IDictionary<object, object> input) =>
74
        input.Get<DownstreamResponse>("DownstreamResponse");
163✔
75

76
    public static DownstreamRoute DownstreamRoute(this IDictionary<object, object> input) =>
77
        input.Get<DownstreamRoute>("DownstreamRoute");
299✔
78

79
    private static T Get<T>(this IDictionary<object, object> input, string key) =>
80
    input.TryGetValue(key, out var value) ? (T)value : default;
958✔
81

82
    private static void Upsert<T>(this IDictionary<object, object> input, string key, T value)
83
    {
1,050✔
84
        if (input.DoesntExist(key))
1,050✔
85
        {
1,050✔
86
            input.Add(key, value);
1,050✔
87
        }
1,050✔
88
        else
89
        {
×
90
            input.Remove(key);
×
91
            input.Add(key, value);
×
92
        }
×
93
    }
1,050✔
94

95
    private static bool DoesntExist(this IDictionary<object, object> input, string key) => !input.ContainsKey(key);
1,050✔
96
}
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