-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Jeremy D. Miller
authored and
Jeremy D. Miller
committed
Apr 11, 2023
1 parent
5c84776
commit 939dc2d
Showing
5 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/Http/Wolverine.Http.Tests/Bugs/bug_298_variable_named_event.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,23 @@ | ||
using Shouldly; | ||
using WolverineWebApi.Bugs; | ||
|
||
namespace Wolverine.Http.Tests.Bugs; | ||
|
||
public class bug_298_variable_named_event : IntegrationContext | ||
{ | ||
public bug_298_variable_named_event(AppFixture fixture) : base(fixture) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task do_not_blow_up() | ||
{ | ||
var (tracked, result) = await TrackedHttpCall(x => | ||
{ | ||
x.Post.Json(new TelegramUpdated("foo")).ToUrl("/convert-book"); | ||
}); | ||
|
||
tracked.Executed.SingleMessage<TelegramUpdated>() | ||
.Name.ShouldBe("foo"); | ||
} | ||
} |
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,27 @@ | ||
using System.Diagnostics; | ||
using Wolverine; | ||
using Wolverine.Http; | ||
|
||
namespace WolverineWebApi.Bugs; | ||
|
||
public class ConvertBookEndpoint | ||
{ | ||
[WolverinePost("/convert-book")] | ||
public static async Task Post( | ||
TelegramUpdated @event, | ||
IMessageBus bus, | ||
CancellationToken token) | ||
{ | ||
await bus.InvokeAsync(@event, token); | ||
} | ||
} | ||
|
||
public record TelegramUpdated(string Name); | ||
|
||
public static class TelegramUpdatedHandler | ||
{ | ||
public static void Handle(TelegramUpdated updated) | ||
{ | ||
Debug.WriteLine("Got TelegramUpdated with name " + updated.Name); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Http/WolverineWebApi/Internal/Generated/WolverineHandlers/POST_convert_book.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; | ||
using Wolverine.Runtime; | ||
|
||
namespace Internal.Generated.WolverineHandlers | ||
{ | ||
// START: POST_convert_book | ||
public class POST_convert_book : Wolverine.Http.HttpHandler | ||
{ | ||
private readonly Wolverine.Http.WolverineHttpOptions _options; | ||
private readonly Wolverine.Runtime.IWolverineRuntime _wolverineRuntime; | ||
|
||
public POST_convert_book(Wolverine.Http.WolverineHttpOptions options, Wolverine.Runtime.IWolverineRuntime wolverineRuntime) : base(options) | ||
{ | ||
_options = options; | ||
_wolverineRuntime = wolverineRuntime; | ||
} | ||
|
||
|
||
|
||
public override async System.Threading.Tasks.Task Handle(Microsoft.AspNetCore.Http.HttpContext httpContext) | ||
{ | ||
var (@event, jsonContinue) = await ReadJsonAsync<WolverineWebApi.Bugs.TelegramUpdated>(httpContext); | ||
if (jsonContinue == Wolverine.HandlerContinuation.Stop) return; | ||
var messageContext = new Wolverine.Runtime.MessageContext(_wolverineRuntime); | ||
await WolverineWebApi.Bugs.ConvertBookEndpoint.Post(@event, ((Wolverine.IMessageBus)messageContext), httpContext.RequestAborted).ConfigureAwait(false); | ||
} | ||
|
||
} | ||
|
||
// END: POST_convert_book | ||
|
||
|
||
} | ||
|
24 changes: 24 additions & 0 deletions
24
...WolverineWebApi/Internal/Generated/WolverineHandlers/TelegramUpdatedHandler96651444.cs.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,24 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
|
||
namespace Internal.Generated.WolverineHandlers | ||
{ | ||
// START: TelegramUpdatedHandler96651444 | ||
public class TelegramUpdatedHandler96651444 : Wolverine.Runtime.Handlers.MessageHandler | ||
{ | ||
|
||
|
||
public override System.Threading.Tasks.Task HandleAsync(Wolverine.Runtime.MessageContext context, System.Threading.CancellationToken cancellation) | ||
{ | ||
var telegramUpdated = (WolverineWebApi.Bugs.TelegramUpdated)context.Envelope.Message; | ||
WolverineWebApi.Bugs.TelegramUpdatedHandler.Handle(telegramUpdated); | ||
return System.Threading.Tasks.Task.CompletedTask; | ||
} | ||
|
||
} | ||
|
||
// END: TelegramUpdatedHandler96651444 | ||
|
||
|
||
} | ||
|
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