Repository navigation
fix: Don't overwrite Content-Length when set as header - #291
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughThe changes modify Content-Length header handling to preserve pre-existing values in response headers instead of overwriting them, and add test coverage to validate this behavior. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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 review |
✅ Actions performedReview triggered.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #291 +/- ##
=======================================
Coverage 91.99% 91.99%
=======================================
Files 97 97
Lines 3661 3662 +1
Branches 1880 1881 +1
=======================================
+ Hits 3368 3369 +1
Misses 293 293 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1777a97 to
08f1c53
Compare
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/src/adapter/io/http_response_extension.dart(1 hunks)test/message/apply_headers_test.dart(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.dart: All Dart code must pass static analysis usingdart analyze --fatal-infoswith no issues
All Dart files must be formatted withdart format(CI enforcesdart format --set-exit-if-changed .)
Files:
test/message/apply_headers_test.dartlib/src/adapter/io/http_response_extension.dart
test/**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
test/**/*.dart: Tests should follow the Given-When-Then pattern in descriptions (flexible structuring allowed)
Use Arrange-Act-Assert pattern within test bodies
Provide clear, descriptive test titles; prefer single responsibility per test unless related assertions improve clarity
Place tests in thetest/directory mirroring thelib/structure
Files:
test/message/apply_headers_test.dart
lib/**/*.dart
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
lib/**/*.dart: Use Uint8List for request/response bodies for performance; avoid List for body payloads
Use type-safe HTTP header parsing and validation when accessing headers
Use router with trie-based matching and symbol-based path parameters (e.g.,#name,#age) for routing
Ensure WebSocket handling includes proper lifecycle management (e.g., ping/pong for connection health)
Files:
lib/src/adapter/io/http_response_extension.dart
🧠 Learnings (3)
📓 Common learnings
Learnt from: nielsenko
Repo: serverpod/relic PR: 38
File: lib/src/headers/exception/header_exception.dart:50-72
Timestamp: 2025-04-02T18:04:20.933Z
Learning: Test coverage for the `MissingHeaderException` class's `httpResponseBody` getter and `toString` method has been deferred to a later time.
Learnt from: nielsenko
Repo: serverpod/relic PR: 48
File: lib/src/handler/handler.dart:59-67
Timestamp: 2025-04-25T07:39:38.915Z
Learning: Nielsenko prefers using switch statements with pattern matching over if statements when working with sealed classes in Dart, as they provide exhaustiveness checking at compile time and can be more concise.
📚 Learning: 2025-10-09T16:21:09.310Z
Learnt from: CR
Repo: serverpod/relic PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-09T16:21:09.310Z
Learning: Applies to lib/**/*.dart : Use type-safe HTTP header parsing and validation when accessing headers
Applied to files:
test/message/apply_headers_test.dartlib/src/adapter/io/http_response_extension.dart
📚 Learning: 2025-10-09T16:21:09.310Z
Learnt from: CR
Repo: serverpod/relic PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-09T16:21:09.310Z
Learning: Applies to test/**/*.dart : Provide clear, descriptive test titles; prefer single responsibility per test unless related assertions improve clarity
Applied to files:
test/message/apply_headers_test.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Run Unit Tests (macos-latest, beta, upgrade)
- GitHub Check: Run Unit Tests (macos-latest, stable, downgrade)
- GitHub Check: Run Unit Tests (macos-latest, beta, downgrade)
- GitHub Check: Run Unit Tests (macos-latest, 3.7.0, downgrade)
- GitHub Check: Run Unit Tests (macos-latest, stable, upgrade)
- GitHub Check: Run Unit Tests (macos-latest, 3.7.0, upgrade)
- GitHub Check: Run Unit Tests (windows-latest, beta, downgrade)
08f1c53 to
f956c54
Compare
f956c54 to
0af1c99
Compare
0af1c99 to
0717f2f
Compare
Description
Preserve
Content-Lengthheader when already set on the HTTP response. Previously,applyHeaderswould overwrite a pre-set content length with the body's content length.Related Issues
Pre-Launch Checklist
///).Breaking Changes
Additional Notes
None.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.