mirror of
https://github.com/gnh1201/welsonjs.git
synced 2026-04-18 18:18:42 +00:00
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:
parent
d7f58a9b0c
commit
3eea89f5a3
|
|
@ -74,7 +74,7 @@ namespace WelsonJS.Launcher.ApiEndpoints
|
|||
{
|
||||
await dispatcher.HandleAsync(
|
||||
body,
|
||||
async (method, id, ser, ct) =>
|
||||
async (method, ser, id, ct) =>
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user