Repository navigation
Add Content-Length only when length is not zero in formatting tests - #3720
Conversation
- Always update Content-Length when the test has already Content-Length. - Add Content-Length only when the length is not zero if the test does not have Content-Length.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Zero-length header check test/regression/regression_test.cc |
The test adds a missing Content-Length header only when the body length is nonzero. Existing header updates and chunked-transfer behavior remain unchanged. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Other
Suggested reviewers: airween
Merge Risk: 
Minimal · up to 00738
-
No actionable merge-blocking risk remains in this test-only change.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the main behavior change: Content-Length is added only when the length is nonzero. The raw summary confirms that update_content_length no longer adds a Content-Length header for a zero-length body when none exists, and the objectives say this stops Content-Length: 0 on GET and HEAD requests. The title is specific and matches the change, though it does not mention that existing headers are still updated.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
|
Thanks @hnakamur, this looks good to me. Not adding An idea for a follow-up, if you're interested: The It would be nice to mark these cases explicitly in the test JSON, for example with a per-test field like: "content_length_mismatch": trueand use it in two places:
The name of the field is of course open for discussion. For reference, the v2 regression test runner ( Would you be interested in taking this on in a separate PR? Thank you again! |
|
@airween Thank you for your comment and proposal for adding |



what
why
Content-Length: 0are added to requests whose method isGETorHEAD, but they should not be added.references
Summary by CodeRabbit
Content-Lengthheader when one was not already provided. Existing length headers continue to be updated, and chunked responses remain unchanged. This keeps headers consistent with empty response bodies while preserving existing behavior for responses with a specified length or chunked transfer.