fix(server): Track status for content-length terminated bodies - #580
Merged
Conversation
jan-auer
marked this pull request as ready for review
July 28, 2026 12:50
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #580 +/- ##
==========================================
- Coverage 87.69% 87.62% -0.08%
==========================================
Files 94 94
Lines 15510 15591 +81
==========================================
+ Hits 13601 13661 +60
- Misses 1909 1930 +21
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7d7bcab. Configure here.
lcian
approved these changes
Jul 28, 2026
lcian
left a comment
Member
There was a problem hiding this comment.
Looks good to me, nice refactor of the tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Streaming responses that declare a
content-lengthwere recorded asclient disconnects (499) in
server.requests.duration, a regressionfrom #555. Hyper stops polling a response body once the declared number
of bytes has been written, so the wrapper never saw an end-of-stream
poll and its guard fell back to 499 when dropped.
MetricsBodynow counts the bytes it forwards and completes the requestonce the declared length is reached, alongside the existing
end-of-stream and trailers cases. Responses whose body hyper never polls
at all are completed up front when they are wrapped.
The tests were reworked around a helper that serves a real axum handler
through the middleware and returns the tracked status and duration,
which made room for a paused-clock test asserting the duration spans
body streaming rather than ending at the response headers. Capturing
metrics across await points needs a new
with_capturing_test_client_asyncinobjectstore-metrics.