From 0ee5e9876813cf501d69ea12277db4e35fe851f0 Mon Sep 17 00:00:00 2001 From: MattMo Date: Wed, 8 Feb 2023 15:23:43 -0800 Subject: [PATCH] Added a missing unit test and fixed another bug with the RouteMatcher. Bumped package version to 1.3.0 --- Rest.Net.Tests/RouteMatcherTests.cs | 6 ++++++ Rest.Net/Rest.Net.csproj | 2 +- Rest.Net/RouteMatcher.cs | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Rest.Net.Tests/RouteMatcherTests.cs b/Rest.Net.Tests/RouteMatcherTests.cs index f99455a..13a0aba 100644 --- a/Rest.Net.Tests/RouteMatcherTests.cs +++ b/Rest.Net.Tests/RouteMatcherTests.cs @@ -10,6 +10,12 @@ namespace MontoyaTech.Rest.Net.Tests { public class RouteMatcherTests { + [Fact] + public void SyntaxWithPathShouldNotMatchRoot() + { + RouteMatcher.Matches("http://localhost/", "/test", out _).Should().BeFalse(); + } + [Fact] public void SyntaxWithRootShouldMatch() { diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj index 56590f6..5b727f3 100644 --- a/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net.csproj @@ -17,7 +17,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.2.9 + 1.3.0 Logo_Symbol_Black_Outline.png diff --git a/Rest.Net/RouteMatcher.cs b/Rest.Net/RouteMatcher.cs index bda6dce..5f9ccc0 100644 --- a/Rest.Net/RouteMatcher.cs +++ b/Rest.Net/RouteMatcher.cs @@ -94,6 +94,11 @@ namespace MontoyaTech.Rest.Net { return true; } + //If we have a syntaxSegment but no urlSegment, this can't be a match. + else if (urlSegment == null && syntaxSegment != null) + { + return false; + } //If we have a url segment see if it matches against the syntax segment. else if (urlSegment != null) {