You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm trying to read response headers from a ClientInterceptor, but I can't find a way that doesn't rely on forcing the users to call their stub methods with return_headers: true.
Example, an interceptor that sets a value in the Process dictionary based on a response header:
defmoduleProcessValueFromHeadersInterceptordo@behaviourGRPC.ClientInterceptor@impltruedefinit(_),do: nil@impltruedefcall(stream,req,next,_opts)do# As far as I can tell, the only way to get the headers is out of the result of calling the next processor# But this depends on whether the stub method was called with `return_headers: true`,# which is outside of the interceptor controlcasenext.(stream,req)do{:ok,_resp,headers}=result->Process.set(:special_header_value,Map.get(headers,"special-header",nil))result# I have no way of reading the response headers from my interceptor in this case,# even if the server sent someresult->resultendendend
Describe the solution you'd like
Being able to easily and consistently read response headers from a ClientInterceptor.
Describe alternatives you've considered
I've tried looking in the source code for workaround ways of reading the headers, but I found no easy options. Maybe Stub.recv/2, but not sure whether that is idempotent or calling it from my interceptor could break the request processing.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm trying to read response headers from a ClientInterceptor, but I can't find a way that doesn't rely on forcing the users to call their stub methods with
return_headers: true
.Example, an interceptor that sets a value in the Process dictionary based on a response header:
Describe the solution you'd like
Being able to easily and consistently read response headers from a ClientInterceptor.
Describe alternatives you've considered
I've tried looking in the source code for workaround ways of reading the headers, but I found no easy options. Maybe
Stub.recv/2
, but not sure whether that is idempotent or calling it from my interceptor could break the request processing.The text was updated successfully, but these errors were encountered: