Conversation
vjik
commented
Aug 19, 2026
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ✔️ |
| Breaks BC? | ❌ |
| Tests pass? | ✔️ |
| Fix #29 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #30 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 112 116 +4
===========================================
Files 23 23
Lines 274 282 +8
===========================================
+ Hits 274 282 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses RFC 9110 compliance gaps around entity/body-related headers on responses that must not include a message body (notably 1xx/204/205), fixing issue #29 and extending middleware configurability to control header removal behavior.
Changes:
RemoveBodyMiddlewarenow removesContent-LengthandTransfer-Encodingwhen it strips the response body (with a default exception for304).ContentLengthMiddlewarenow removes an already-presentContent-Lengthfor status codes that must not include it.- Adds/updates tests, documentation, and changelog entries to cover the new behavior and configuration.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/RemoveBodyMiddleware.php |
Removes body-describing headers when stripping bodies; adds config for keeping/removing headers by status code. |
src/ContentLengthMiddleware.php |
Adds configurable removal of pre-existing Content-Length on disallowed status codes. |
tests/RemoveBodyMiddlewareTest.php |
Adds tests for header removal defaults and customization. |
tests/ContentLengthMiddlewareTest.php |
Adds tests for removing pre-existing Content-Length on disallowed status codes and customization. |
docs/guide/en/remove-body-middleware.md |
Documents new header-removal behavior and new constructor parameters. |
docs/guide/en/content-length-middleware.md |
Documents new removeOnStatusCode behavior and defaults. |
CHANGELOG.md |
Records the new parameters and bugfix behavior under 1.2.2. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.