Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Bug in server to server RPC calls #162

Open
delasource opened this issue Jul 14, 2023 · 0 comments · May be fixed by #163
Open

Possible Bug in server to server RPC calls #162

delasource opened this issue Jul 14, 2023 · 0 comments · May be fixed by #163

Comments

@delasource
Copy link

The apiClient.rpcFunc2 function makes a GET call and i'm not sure why it does. The “payload” query param seems to be ignored in the GET case, making httpkey-requests totally pointless and the library actually useless. I may be doing something wrong, but i can’t find any hint in the documentation.

Reproduce:

Consider the following RPC: (typescript runtime)

initializer.registerRpc('pong',  (ctx, logger, nk, payload) => {
  return JSON.stringify({ my_payload_is: payload });
});

This POST call works:

$ curl "http://127.0.0.1:7350/v2/rpc/pong?http_key=defaulthttpkey" -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST -d "\"money\""
{"payload":"{\"my_payload_is\":\"money\"}"}

however this doesnt:

$ curl "http://127.0.0.1:7350/v2/rpc/pong?http_key=defaulthttpkey&payload=\"money\"" -H 'Content-Type: application/json' -H 'Accept: application/json' -X GET
{"payload":"{\"my_payload_is\":\"\"}"}

So i think the rpcHttpKey function (or the rpcFunc2) should also speak POST instead of GET. (the session-based RPC stuff actually uses POST and works fine)

@delasource delasource linked a pull request Jul 14, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant