Skip to content

Commit

Permalink
Update notExists to true when value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
caseysun11 committed Feb 20, 2024
1 parent da38760 commit 74b1c16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ReverseProxy/Routing/HeaderMatcherPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates)
var matched = matcher.Mode switch
{
HeaderMatchMode.Exists => !valueIsEmpty,
HeaderMatchMode.NotExists => !headerExists,
HeaderMatchMode.NotExists => !headerExists || valueIsEmpty,
HeaderMatchMode.ExactHeader => !valueIsEmpty && TryMatchExactOrPrefix(matcher, requestHeaderValues),
HeaderMatchMode.HeaderPrefix => !valueIsEmpty && TryMatchExactOrPrefix(matcher, requestHeaderValues),
HeaderMatchMode.Contains => !valueIsEmpty && TryMatchContainsOrNotContains(matcher, requestHeaderValues),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void AppliesToEndpoints_NoMetadata_DoesNotApply()
[InlineData("", HeaderMatchMode.Exists, false)]
[InlineData("abc", HeaderMatchMode.Exists, true)]
[InlineData(null, HeaderMatchMode.NotExists, true)]
[InlineData("", HeaderMatchMode.NotExists, false)]
[InlineData("", HeaderMatchMode.NotExists, true)]
[InlineData("abc", HeaderMatchMode.NotExists, false)]
public async Task ApplyAsync_MatchingScenarios_AnyHeaderValue(string incomingHeaderValue, HeaderMatchMode mode, bool shouldMatch)
{
Expand Down

0 comments on commit 74b1c16

Please sign in to comment.