mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-20 16:01:39 +02:00
Fixed QueryStringParser for UrlEncoded values (#911)
This commit is contained in:
@@ -32,7 +32,7 @@ internal static class QueryStringParser
|
|||||||
{
|
{
|
||||||
if (part.Length == 2)
|
if (part.Length == 2)
|
||||||
{
|
{
|
||||||
nameValueCollection.Add(part[0], part[1]);
|
nameValueCollection.Add(part[0], WebUtility.UrlDecode(part[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,21 @@ public class QueryStringParserTests
|
|||||||
actual.Should().BeEquivalentTo(expectedOutput);
|
actual.Should().BeEquivalentTo(expectedOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TryParse_Should_Parse_QueryStringWithUrlEncodedValues()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var key = "x";
|
||||||
|
var value = "rNaCP7hv8UOmS%2FJcujdvLw%3D%3D";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = QueryStringParser.TryParse($"{key}={value}", true, out var actual);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Should().BeTrue();
|
||||||
|
actual.Should().BeEquivalentTo(new Dictionary<string, string> { { "x", "rNaCP7hv8UOmS/JcujdvLw==" } });
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Parse_WithNullString()
|
public void Parse_WithNullString()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user