Skip to content

Commit

Permalink
Do not discard trailers when checking streaming response status
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudy committed Apr 13, 2024
1 parent 57b433e commit 6e4682b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tonic/src/codec/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,9 @@ impl StreamingInner {

fn response(&mut self) -> Result<(), Status> {
if let Direction::Response(status) = self.direction {
if let Some(trailers) = self.trailers.take() {
if let Err(e) = crate::status::infer_grpc_status(Some(&trailers), status) {
if let Some(e) = e {
return Err(e);
}
if let Err(e) = crate::status::infer_grpc_status(self.trailers.as_ref(), status) {
if let Some(e) = e {
return Err(e);
}
}
}
Expand Down Expand Up @@ -390,9 +388,6 @@ impl<T> Stream for Streaming<T> {
return Poll::Ready(None);
}

// FIXME: implement the ability to poll trailers when we _know_ that
// the consumer of this stream will only poll for the first message.
// This means we skip the poll_trailers step.
if let Some(item) = self.decode_chunk()? {
return Poll::Ready(Some(Ok(item)));
}
Expand Down

0 comments on commit 6e4682b

Please sign in to comment.