Skip to content

Remove inconsistent headers in RemoveBodyMiddleware and ContentLengthMiddleware - #30

Open
vjik wants to merge 5 commits into
masterfrom
fix-29
Open

Remove inconsistent headers in RemoveBodyMiddleware and ContentLengthMiddleware#30
vjik wants to merge 5 commits into
masterfrom
fix-29

Conversation

@vjik

@vjik vjik commented Aug 19, 2026

Copy link
Copy Markdown
Member
Q A
Is bugfix? ✔️
New feature? ✔️
Breaks BC?
Tests pass? ✔️
Fix #29

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2d05f7a) to head (93c7bb7).
⚠️ Report is 2 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • RemoveBodyMiddleware now removes Content-Length and Transfer-Encoding when it strips the response body (with a default exception for 304).
  • ContentLengthMiddleware now removes an already-present Content-Length for 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.

Comment thread src/RemoveBodyMiddleware.php
Comment thread src/ContentLengthMiddleware.php
Comment thread src/RemoveBodyMiddleware.php

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@vjik
vjik requested a review from a team August 19, 2026 08:51
@vjik vjik added the status:code review The pull request needs review. label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RemoveBodyMiddleware leaves Content-Length on 204 / 1xx responses

2 participants