Open ivan-rodriguez-ag opened 1 year ago
Since your string appears to be base64 encoded your second attempt looks more promising to me.
How did you get the body string in the first place? The error "Expected trailers header 0x80"
suggests to me that you might not be getting the expected body format that this library was designed for (the grpc-web protocol)
In my case i read the body of the request (this contains the string i shared) that is the one that grpc-web send for the requests. I think the problem is that i am trying to decode any Message
from grpc-web
and maybe this decoder id built for specific signature? Because i'll need to tell the deserializer the class to use if not i'll recieve a binary or something similar i guess
Yea so if your body message is of the expected format, you will get a GrpcResponse type back
This contains the message which itself is a bytearray that you would use one of your protobuf messages to decode. So to clarify decodeGrpcWebBody
does not turn a http message body into a javascript representation of your proto object, rather it parses the specific syntax of the grpc-web protocol so that you get your hands on the bytes to then parse with the generated protos.
Are you using playwright though? I wouldn't expect direct usage of decodeGrpcWebBody
to be necessary if so.
Hi,
I am building mock server with express and i am using your library to serialize and deserialize proto objects but now i am facing a problem to deserialize the request body of a proto in the express server.
My idea Is to read the body string (something like this
AAAAAAMKATE=
) and use your function to decodeBut i get the following error:
throw new Error("Unrecognised status code [".concat(status, "]"));
I tried:
but in this case i had the error:
throw new Error("Expected trailers header 0x80");
Is it right to get the string and generate a buffer from the string? Should i read the express body as buffer?
I am completely lost about what is happening here, i don't know if you have some clue
Thanks