-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
gRPC - Request/Response body as byte array/JSON #12626
Comments
I'm started to think probably we need to consolidate C++ implemented utilities (that is exposed to the Lua world) into a dedicated "wrapper", either to be attached to the stream handle or available globally. We see e.g.
If attaching to stream handler wrapper is preferred (this is in line with function envoy_on_request(request_handle) {
request_handle:utility():base64Encode("ok");
request_handle:utility():currentTimestamp();
request_handle:utility():getJsonStringFromProtoMessageBuffer(request_handle.body());
} Or if we prefer it to be available globally, since the functionality doesn't need access to the current stream. function envoy_on_request(request_handle) {
envoyBase64Encode("ok");
envoyCurrentTimestamp();
envoyGetJsonStringFromProtoMessageBuffer(request_handle.body());
} |
Sure all of that SGTM @dio |
Is there anything currently available to achieve this in lua filter ? |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
@paawan01 you can get the data "bytes", via
Hence a call to it ends up with a value that looks like Try this instead:
But yeah you can't really work with the encoded protobuf messages in Lua yet, but you can forward that data to another service. |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions. |
I have set up a lua filter for accessing the request/response details [headers and body] for a gRPC service. I am able to see proper headers data. The request/response data is of the form 'userdata : xxxxxxxxxxx'
For example:
print (request_handle:body()) -> userdata: 0x40dae6a0
The text was updated successfully, but these errors were encountered: