-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Shouldly; | ||
|
||
namespace Wolverine.Http.Tests; | ||
|
||
public class route_wildcard : IntegrationContext | ||
{ | ||
public route_wildcard(AppFixture fixture) : base(fixture) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task wildcard() | ||
{ | ||
var body = await Scenario(x => | ||
{ | ||
x.Get.Url("/wildcard/one/two/three"); | ||
}); | ||
|
||
body.ReadAsText().ShouldBe("one/two/three"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/GET_wildcard_name.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
using Microsoft.AspNetCore.Routing; | ||
using System; | ||
using System.Linq; | ||
using Wolverine.Http; | ||
|
||
namespace Internal.Generated.WolverineHandlers | ||
{ | ||
// START: GET_wildcard_name | ||
public class GET_wildcard_name : Wolverine.Http.HttpHandler | ||
{ | ||
private readonly Wolverine.Http.WolverineHttpOptions _wolverineHttpOptions; | ||
|
||
public GET_wildcard_name(Wolverine.Http.WolverineHttpOptions wolverineHttpOptions) : base(wolverineHttpOptions) | ||
{ | ||
_wolverineHttpOptions = wolverineHttpOptions; | ||
} | ||
|
||
|
||
|
||
public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) | ||
{ | ||
var wildcardEndpoint = new WolverineWebApi.WildcardEndpoint(); | ||
var name = (string)httpContext.GetRouteValue("name"); | ||
|
||
// The actual HTTP request handler execution | ||
var result_of_Wildcard = wildcardEndpoint.Wildcard(name); | ||
|
||
await WriteString(httpContext, result_of_Wildcard); | ||
} | ||
|
||
} | ||
|
||
// END: GET_wildcard_name | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Wolverine.Http; | ||
|
||
namespace WolverineWebApi; | ||
|
||
public class WildcardEndpoint | ||
{ | ||
[WolverineGet("/wildcard/{*name}")] | ||
public string Wildcard(string name) | ||
{ | ||
return name; | ||
} | ||
} |