Skip to content

Commit 39f9f11

Browse files
committed
tonic-web: Merge subsequent trailer frames
Ideally, a body should only return a single trailer frame. If multiple trailers are returned, merge them together.
1 parent deab62b commit 39f9f11

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tonic-web/src/call.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,14 @@ where
264264
}
265265
Some(Ok(incoming_buf)) if incoming_buf.is_trailers() => {
266266
let trailers = incoming_buf.into_trailers().unwrap();
267-
me.as_mut().project().trailers.replace(trailers);
267+
match me.as_mut().project().trailers {
268+
Some(current_trailers) => {
269+
current_trailers.extend(trailers);
270+
}
271+
None => {
272+
me.as_mut().project().trailers.replace(trailers);
273+
}
274+
}
268275
continue;
269276
}
270277
Some(Ok(_)) => unreachable!("unexpected frame type"),

0 commit comments

Comments
 (0)