roadrunner icon indicating copy to clipboard operation
roadrunner copied to clipboard

[🧹 CHORE]: Allow sending gRPC status code payload as json or base64 encoded binary

Open rauanmayemir opened this issue 3 years ago • 0 comments

No duplicates 🥲.

  • [X] I have searched for a similar issue.

What should be improved or cleaned up?

Since roadrunner-server/grpc#38, it's possible to return error as a legitimate response as part of rpc metadata. However, error payload is expected to be binary which is not possible in json.

So payload has to be either json or base64-encoded binary. I.e this:

{
    "error": "binary_protobuf_payload_with_unprintable_characters"
}

has to become either

{
    "error": "json_serialized_escaped_protobuf_payload"
}

or

{
    "error": "base64_encoded_protobuf_payload"
}

I would personally go for base64-encoded payload because json marshaling could be different in PHP/Go and serialized escaped json string arguably doesn't look that great.

rauanmayemir avatar Sep 05 '22 04:09 rauanmayemir