Hello, I’m looking into the details of accessing request and response metadata on both client and server side, including from a chain of client and server interceptors. There’s some documentation here <https://grpc.io/docs/guides/metadata/> and a Python example here <https://github.com/grpc/grpc/tree/master/examples/python/metadata>, but I still have a few questions.
In the linked Python example, a client sends initial metadata with the request (code <https://github.com/grpc/grpc/blob/9ac4b4d2f4b491670d60a6b1243ef7867f0dd106/examples/python/metadata/metadata_client.py#L33-L41>) and then reads trailing metadata with the response (code <https://github.com/grpc/grpc/blob/9ac4b4d2f4b491670d60a6b1243ef7867f0dd106/examples/python/metadata/metadata_client.py#L44-L48>). Likewise, a server reads the initial metadata from a request (code <https://github.com/grpc/grpc/blob/9ac4b4d2f4b491670d60a6b1243ef7867f0dd106/examples/python/metadata/metadata_server.py#L28-L29>) and then sends trailing metadata with the response (code <https://github.com/grpc/grpc/blob/9ac4b4d2f4b491670d60a6b1243ef7867f0dd106/examples/python/metadata/metadata_server.py#L31-L36> ). But given the *ServicerContext.send_initial_metadata()* function (docs <https://grpc.github.io/grpc/python/grpc.html#grpc.ServicerContext.send_initial_metadata>) it seems to me that a server can also send initial metadata with a response? How would a client read that, using the *Call.initial_metadata()*function (docs <https://grpc.github.io/grpc/python/grpc.html#grpc.Call.initial_metadata>)? More interestingly, in a chain of server interceptors, how can one server interceptor read the initial/trailing response metadata sent by another downstream interceptor or the method handler itself? The docs list a *ServicerContext.set_trailing_metadata()* function (docs <https://grpc.github.io/grpc/python/grpc.html#grpc.ServicerContext.set_trailing_metadata>) and a *ServicerContext.trailing_metadata()* function (code <https://grpc.github.io/grpc/python/grpc.html#grpc.ServicerContext.trailing_metadata>), but they do not show an equivalent to access the initial metadata for a response? And likewise with client interceptors? Much thanks! Jens -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/grpc-io/67d3214a-0eba-46bd-b013-5426f1c3a4f2n%40googlegroups.com.
