Route arguments are now automatically url decoded by the RouteMatcher. Added a unit test to cover this case. Bumped package version to 1.1.8
This commit is contained in:
parent
023654aba2
commit
f8704e425b
@ -69,6 +69,14 @@ namespace MontoyaTech.Rest.Net.Tests
|
|||||||
arguments[1].Should().Be("2");
|
arguments[1].Should().Be("2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SyntaxWithArgumentsUrlEncodedShouldDecode()
|
||||||
|
{
|
||||||
|
RouteMatcher.Matches("http://localhost/a/b%20c", "/a/{name}", out string[] arguments).Should().BeTrue();
|
||||||
|
arguments.Length.Should().Be(1);
|
||||||
|
arguments[0].Should().Be("b c");
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SyntaxWithWildcardShouldMatch()
|
public void SyntaxWithWildcardShouldMatch()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
||||||
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<Version>1.1.7</Version>
|
<Version>1.1.8</Version>
|
||||||
<PackageReleaseNotes></PackageReleaseNotes>
|
<PackageReleaseNotes></PackageReleaseNotes>
|
||||||
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
|
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace MontoyaTech.Rest.Net
|
namespace MontoyaTech.Rest.Net
|
||||||
{
|
{
|
||||||
@ -121,7 +122,7 @@ namespace MontoyaTech.Rest.Net
|
|||||||
}
|
}
|
||||||
else if (condition.StartsWith("{") && condition.EndsWith("}"))
|
else if (condition.StartsWith("{") && condition.EndsWith("}"))
|
||||||
{
|
{
|
||||||
arguments[argumentIndex++] = urlSegment;
|
arguments[argumentIndex++] = WebUtility.UrlDecode(urlSegment);
|
||||||
|
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user