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 and a Python example
here, but I still have a few questions.
In the linked Python example, a client sends initial metadata with the request (
code) and then reads trailing metadata with the response (
code). Likewise, a server reads the initial metadata from a request (
code) and then sends trailing metadata with the response (
code).
But given the
ServicerContext.send_initial_metadata() function (
docs) 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)?
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) and a
ServicerContext.trailing_metadata() function (
code), but they do not show an equivalent to access the initial metadata for a response?
And likewise with client interceptors?
Much thanks!
Jens