improbable-eng / ts-protoc-gen

Protocol Buffers Compiler (protoc) plugin for TypeScript and gRPC-Web.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accessing metadata while calling a client method

p-berton opened this issue · comments

What happened
When using a gRPC client stub generated with protoc and grpc-web the returned response doesn't contain any metadata.
What you expected to happen
I want to be able to retrieve and use response metadata to check some connection parameters (for example if the session is still authorized to perform some actions) instead of create a custom message in the .proto file.
Anything else we need to know
By analyzing the code I've seen that during grpc-web javascript file generation in the unary stub method (link), when the response is OK, only the response.message gets returned. Maybe could be useful if via settings or something similar we can set if the method should return also the trailing metadata. I want to know if this implementation was done for simplicity or for bug/error prevention, and in this case how can I retrieve the response metadata in a safe way.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.