How to set Vec<u8> to body while implementing tonic::codegen::Service #815
Unanswered
mustakimali
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am implementing
tonic::codegen::Service
for my use case to be able to start a mock gRPC server that works with any service at runtime. The response body I need to return is aVec<u8>
instead of structs likeHelloReply
.This code does not compile as
body
function accepts a different type.I am trying to figure out how to use that
Vec<u8>
as the parameter ofbody
function ofhttp::Response::builder()
. So far I was able to come up with thisThis code compiles, however when I invoke this rpc using the generated client code i get an
Err
.So to summarise, is it possible to use
Vec<u8>
representation ofHelloReply
and still be able to return a valid gRPC response? Thank you for your help 🙏🏽Beta Was this translation helpful? Give feedback.
All reactions