Skip to content

Possible Bug in server to server RPC calls #162

@delasource

Description

@delasource

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions