Skip to content

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

Closed
PingruiLi wants to merge 1 commit intotrpc-group:masterfrom
PingruiLi:fix-http-resp-header
Closed

trpc-proto-http: fix response header parsing in HttpConsumerInvoker#134
PingruiLi wants to merge 1 commit intotrpc-group:masterfrom
PingruiLi:fix-http-resp-header

Conversation

@PingruiLi
Copy link
Copy Markdown
Contributor

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.

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.
@PingruiLi
Copy link
Copy Markdown
Contributor Author

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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


pingruili seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

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

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##                master        #134         +/-   ##
=====================================================
- Coverage     85.86737%   85.83855%   -0.02882%     
+ Complexity        4324        4319          -5     
=====================================================
  Files              436         436                 
  Lines            14371       14370          -1     
  Branches          1287        1286          -1     
=====================================================
- Hits             12340       12335          -5     
- Misses            2031        2035          +4     
Files with missing lines Coverage Δ
...nt/trpc/proto/http/client/HttpConsumerInvoker.java 100.00000% <100.00000%> (ø)

... and 2 files with indirect coverage changes

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

import org.junit.Test;

/**
* 测试 HttpConsumerInvoker 中 handleResponse 的响应头解析逻辑
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

需要改成英文注释,或者删除注释

@wardseptember
Copy link
Copy Markdown
Collaborator

此修改已在别的pr合并

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