-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
How to modify the returned metadata #7125
Comments
@aranjans you can assign it to me |
@baozi-2019 could you provide more context on why you are not returning the error (returning nil) from your interceptor? |
@baozi-2019 you need to return a non-nil error otherwise the client will not receive any explicit indication of success or failure for the RPC call, and the associated context modifications made by the interceptor may not be observable by the client. |
In order to add metadata to context from Unary RPC server, you can use Having said that, metadata.FromOutgoingContext(ctx) doesn't work on server, you need to use metadata.FromIncomingContext(ctx) to read metadata by the client. Refer documentation for sending and receiving metadata https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md#sending-and-receiving-metadata---server-side |
I want to add error message to returned metadata,but it does not work.This is my code.
The text was updated successfully, but these errors were encountered: