fix(http/retry): is_end_stream()
is true for empty bodies
#3558
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this commit fixes a small, subtle bug in
PeekTrailersBody<B>
.if wrapping an empty body, the peek body will inspect the wrong
Option<T>
in the trailers field with the following type:for an empty body, we know that there are no trailers, which means that we have
Some(Ok(None))
.consider also, the documentation of
is_end_stream()
:we can guarantee in this case that
poll_trailers()
will returnOk(None)
since we've already called it and proven that to be the case. we are holding that value, after all.this change will not affect any behavior w.r.t. what the peek body yields, but it will mean that it reports
is_end_stream()
correctly when it wraps an empty body.