-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
I want to send some trailers for grpc server streams when an error occurs mid-stream after status 200 and some data has been proxied to the client.
I do the following in the grpc server function
if err != nil {
grpc.SetTrailer(out.Context(), metadata.Pairs("grpc-status", "13"))
grpc.SetTrailer(out.Context(), metadata.Pairs("stream-error", "true"))
return err
}
I do not see trailers returned in the http response ( The request has header "TE: trailers" set). I see that FowardResponseMessage () adds trailers for unary grpc, but I do not see that ForwardResponseStream() for streaming rpc adds trailers.
How do we configure grpc-gateway so grpc servers streams error trailers are sent? I considered using: WithStreamErrorHandler to customize a handler but the handler which gets called in handleForwardResponseStreamError() does not have access to the response writer and handleForwardReponseStreamError() doesn't add trailers