Skip to content

How are response trailers managed? #3620

Answered by seanmonstar
ogxd asked this question in Q&A
Discussion options

You must be logged in to vote

The trailers are basically "headers" that come at the end of the body. They sorta exist in HTTP/1.1, but are a better supported thing in HTTP/2 and 3, so gRPC uses them to indicate the "status" of a message. hyper (0.14.x) exposes them in the body as poll_trailers(). If you make use of hyper::body::HttpBody, the trait, there's a replacement for to_bytes(), which is HttpBody::collect(). It will also have collected the trailers (to_bytes() just tosses them).

However, gRPC makes heavy use of streaming bodies, so you might find buffering till the end in a proxy causes problems. Some gRPC services assume they can send a message sporadically or on an interval, and expect a streamed reply back, …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ogxd
Comment options

@ogxd
Comment options

Answer selected by ogxd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants