Fix JSON-RPC dispatcher callback params

Reordered the parameters for the JSON-RPC dispatch callback to ensure the serializer and request id are passed in the correct positions. Updated the Func signature in JsonRpc2Dispatcher.cs to include the int id parameter before the CancellationToken, and adjusted the invocation/lambda in JsonRpc2.cs to match (method, ser, id, ct), preventing parameter mismatches when handling requests.
This commit is contained in:
Namhyeon, Go 2026-03-16 21:17:51 +09:00
parent d7f58a9b0c
commit 3eea89f5a3
2 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ namespace WelsonJS.Launcher.ApiEndpoints
{
await dispatcher.HandleAsync(
body,
async (method, id, ser, ct) =>
async (method, ser, id, ct) =>
{
switch (method)
{

View File

@ -33,7 +33,7 @@ namespace WelsonJS.Launcher
public async Task<string> HandleAsync(
string requestBody,
Func<string, JsSerializer, CancellationToken, Task<string>> dispatchMethodAsync,
Func<string, JsSerializer, int, CancellationToken, Task<string>> dispatchMethodAsync,
CancellationToken ct)
{
if (string.IsNullOrEmpty(requestBody))
@ -62,7 +62,7 @@ namespace WelsonJS.Launcher
Method = method
};
return await dispatchMethodAsync(req.Method, id, ser, ct);
return await dispatchMethodAsync(req.Method, ser, id, ct);
}
catch (JsonRpc2Exception)
{