trpc-proto-http: fix response header parsing in HttpConsumerInvoker#135
Merged
wardseptember merged 2 commits intotrpc-group:masterfrom Apr 7, 2026
Merged
Conversation
The previous implementation iterated over HeaderElement objects and called element.getName() to extract header values. This only returns the token before the first '=' or ';' delimiter, causing truncation of composite header values such as: Content-Type: application/json; charset=utf-8 -> "application/json" X-Token: key=abc123 -> "key" Set-Cookie: sessionId=abc; Path=/; HttpOnly -> "sessionId" Fix this by calling header.getValue() directly to obtain the complete header value, consistent with the approach already used in Http2ConsumerInvoker. Also remove the now-unused HeaderElement import. Add HttpConsumerInvokerTest covering: - simple header values (no delimiters) - composite values containing semicolons (core fix scenario) - values containing equals signs - multiple headers all stored correctly - header values stored as byte[] (tRPC protocol consistency) - non-200 status code throws TRpcException - zero Content-Length returns empty response body - complex cookie header with multiple semicolons and equals signs - non-zero Content-Length with response body decoded correctly
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #135 +/- ##
=====================================================
- Coverage 85.86737% 85.83159% -0.03578%
+ Complexity 4324 4319 -5
=====================================================
Files 436 436
Lines 14371 14370 -1
Branches 1287 1286 -1
=====================================================
- Hits 12340 12334 -6
- Misses 2031 2036 +5
🚀 New features to boost your workflow:
|
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.
No description provided.