Skip to content

Commit aa4e695

Browse files
CopilotMihaZupan
andauthored
Include MaxRequestBodySize in route config equality to trigger route reloads (#3027)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
1 parent 75fe309 commit aa4e695

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎src/ReverseProxy/Configuration/RouteConfig.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public bool Equals(RouteConfig? other)
118118
&& string.Equals(TimeoutPolicy, other.TimeoutPolicy, StringComparison.OrdinalIgnoreCase)
119119
&& Timeout == other.Timeout
120120
&& string.Equals(CorsPolicy, other.CorsPolicy, StringComparison.OrdinalIgnoreCase)
121+
&& MaxRequestBodySize == other.MaxRequestBodySize
121122
&& Match == other.Match
122123
&& CaseSensitiveEqualHelper.Equals(Metadata, other.Metadata)
123124
&& CaseSensitiveEqualHelper.Equals(Transforms, other.Transforms);
@@ -136,6 +137,7 @@ public override int GetHashCode()
136137
hash.Add(Timeout?.GetHashCode());
137138
hash.Add(TimeoutPolicy?.GetHashCode(StringComparison.OrdinalIgnoreCase));
138139
hash.Add(CorsPolicy?.GetHashCode(StringComparison.OrdinalIgnoreCase));
140+
hash.Add(MaxRequestBodySize);
139141
hash.Add(Match);
140142
hash.Add(CaseSensitiveEqualHelper.GetHashCode(Metadata));
141143
hash.Add(CaseSensitiveEqualHelper.GetHashCode(Transforms));

‎test/ReverseProxy.Tests/Configuration/RouteConfigTests.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public void Equals_Positive()
2121
Timeout = TimeSpan.FromSeconds(1),
2222
ClusterId = "c",
2323
CorsPolicy = "co",
24+
MaxRequestBodySize = 1024,
2425
Match = new RouteMatch()
2526
{
2627
Headers = new[]
@@ -52,6 +53,7 @@ public void Equals_Positive()
5253
Timeout = TimeSpan.FromSeconds(1),
5354
ClusterId = "C",
5455
CorsPolicy = "Co",
56+
MaxRequestBodySize = 1024,
5557
Match = new RouteMatch()
5658
{
5759
Headers = new[]
@@ -94,6 +96,7 @@ public void Equals_Negative()
9496
Timeout = TimeSpan.FromSeconds(1),
9597
ClusterId = "c",
9698
CorsPolicy = "co",
99+
MaxRequestBodySize = 1024,
97100
Match = new RouteMatch()
98101
{
99102
Headers = new[]
@@ -127,6 +130,7 @@ public void Equals_Negative()
127130
var i = a with { RateLimiterPolicy = "i" };
128131
var j = a with { TimeoutPolicy = "j" };
129132
var k = a with { Timeout = TimeSpan.FromSeconds(107) };
133+
var l = a with { MaxRequestBodySize = 2048 };
130134

131135
Assert.False(a.Equals(b));
132136
Assert.False(a.Equals(c));
@@ -138,6 +142,7 @@ public void Equals_Negative()
138142
Assert.False(a.Equals(i));
139143
Assert.False(a.Equals(j));
140144
Assert.False(a.Equals(k));
145+
Assert.False(a.Equals(l));
141146
}
142147

143148
[Fact]
@@ -155,6 +160,7 @@ public void RouteConfig_CanBeJsonSerialized()
155160
RateLimiterPolicy = "rl",
156161
ClusterId = "c",
157162
CorsPolicy = "co",
163+
MaxRequestBodySize = 1024,
158164
Match = new RouteMatch()
159165
{
160166
Headers = new[]

0 commit comments

Comments
 (0)