Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
- "MSSQL_PID=Developer"

pulsar:
image: "apachepulsar/pulsar:4.0"
image: "apachepulsar/pulsar:4.0.3"
ports:
- "6650:6650"
- "8080:8080"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Shouldly;

namespace Wolverine.Http.Tests.Bugs;

public class Bug_2352_fromquery_name_with_dots : IntegrationContext
{
public Bug_2352_fromquery_name_with_dots(AppFixture fixture) : base(fixture)
{
}

[Fact]
public async Task should_use_dotted_fromquery_name_for_string_parameters()
{
var body = await Scenario(x =>
{
x.Get.Url("/querystring/dotted?hub.mode=subscribe&hub.challenge=abc123&hub.verify_token=mytoken");
});

body.ReadAsText().ShouldBe("subscribe|abc123|mytoken");
}

[Fact]
public async Task should_use_dotted_fromquery_name_for_int_parameter()
{
var body = await Scenario(x =>
{
x.Get.Url("/querystring/dotted-int?page.number=42");
});

body.ReadAsText().ShouldBe("page 42");
}
}
2 changes: 1 addition & 1 deletion src/Http/Wolverine.Http/CodeGen/CodeGenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ internal static class CodeGenExtensions
{
public static string SanitizeFormNameForVariable(this string variableName)
{
return variableName.Replace("/", "_").Replace("-", "_");
return variableName.Replace("/", "_").Replace("-", "_").Replace(".", "_");
}
}
19 changes: 19 additions & 0 deletions src/Http/WolverineWebApi/QuerystringEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ public static string DateOnlyNullable(DateOnly? value)
}
}

public static class DottedFromQueryEndpoints
{
[WolverineGet("/querystring/dotted")]
public static string HandleDottedQueryNames(
[FromQuery(Name = "hub.mode")] string hubMode,
[FromQuery(Name = "hub.challenge")] string hubChallenge,
[FromQuery(Name = "hub.verify_token")] string hubVerifyToken)
{
return $"{hubMode}|{hubChallenge}|{hubVerifyToken}";
}

[WolverineGet("/querystring/dotted-int")]
public static string HandleDottedIntQueryName(
[FromQuery(Name = "page.number")] int pageNumber)
{
return $"page {pageNumber}";
}
}

public static class FromQueryEndpoints
{
[WolverineGet("/api/fromquery1")]
Expand Down
Loading