Skip to content

trpc-proto-http: fix response header parsing in HttpConsumerInvoker#135

Merged
wardseptember merged 2 commits intotrpc-group:masterfrom
PingruiLi:fix-http-resp-header-github-account
Apr 7, 2026
Merged

trpc-proto-http: fix response header parsing in HttpConsumerInvoker#135
wardseptember merged 2 commits intotrpc-group:masterfrom
PingruiLi:fix-http-resp-header-github-account

Conversation

@PingruiLi
Copy link
Copy Markdown
Contributor

No description provided.

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
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@PingruiLi
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.83159%. Comparing base (2c3fdd0) to head (9befff8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@                  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     
Files with missing lines Coverage Δ
...nt/trpc/proto/http/client/HttpConsumerInvoker.java 100.00000% <100.00000%> (ø)

... and 3 files with indirect coverage changes

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

@wardseptember wardseptember merged commit 6ebdde6 into trpc-group:master Apr 7, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants