diff --git a/tonic/src/codec/decode.rs b/tonic/src/codec/decode.rs index 8cba8ba88..18412d733 100644 --- a/tonic/src/codec/decode.rs +++ b/tonic/src/codec/decode.rs @@ -285,6 +285,9 @@ impl StreamingInner { if let Direction::Response(status) = self.direction { if let Err(e) = crate::status::infer_grpc_status(self.trailers.as_ref(), status) { if let Some(e) = e { + // If the trailers contain a grpc-status, then we should return that as the error + // and otherwise stop the stream (by taking the error state) + self.trailers.take(); return Err(e); } }