Skip to content

transport: surface subsequent data when receiving non-gRPC header#8929

Open
chengxilo wants to merge 8 commits intogrpc:masterfrom
chengxilo:surface-response-body
Open

transport: surface subsequent data when receiving non-gRPC header#8929
chengxilo wants to merge 8 commits intogrpc:masterfrom
chengxilo:surface-response-body

Conversation

@chengxilo
Copy link

@chengxilo chengxilo commented Feb 22, 2026

Fixes #7406

If content-type is not grpc, we read the next data frames till 1kb or endStream, and append the subsequent data to error message.

Example:

When receiving

[header]
":status", "200",
"content-type", "text/html",

[payload]
<html><body>Hello World</body></html>

Return

rpc error: code = Unknown desc = unexpected HTTP status code received from server: 200 (OK); transport: received unexpected content-type "text/html"
data: "<html><body>Hello World</body></html>"`,

RELEASE NOTES:

  • Surface data when receiving non-gRPC header, append it to the error message with this formet [error]\n data: "[data]"

@chengxilo chengxilo force-pushed the surface-response-body branch from d42d1a5 to 3dc8573 Compare February 22, 2026 21:53
@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 82.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.20%. Comparing base (7136e99) to head (685f4ef).

Files with missing lines Patch % Lines
internal/transport/http2_client.go 80.00% 4 Missing and 1 partial ⚠️
internal/transport/client_stream.go 84.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8929      +/-   ##
==========================================
- Coverage   83.23%   83.20%   -0.03%     
==========================================
  Files         417      417              
  Lines       32969    33018      +49     
==========================================
+ Hits        27441    27472      +31     
- Misses       4105     4112       +7     
- Partials     1423     1434      +11     
Files with missing lines Coverage Δ
internal/transport/client_stream.go 94.28% <84.00%> (-5.72%) ⬇️
internal/transport/http2_client.go 92.24% <80.00%> (-0.41%) ⬇️

... and 24 files with indirect coverage changes

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

@chengxilo chengxilo changed the title feat: surface response data when receiving an unexpected status code … feat: surface subsequent data when receiving non-gRPC header Feb 22, 2026
@chengxilo chengxilo changed the title feat: surface subsequent data when receiving non-gRPC header transport: surface subsequent data when receiving non-gRPC header Feb 23, 2026
@easwars easwars added Type: Behavior Change Behavior changes not categorized as bugs Area: Transport Includes HTTP/2 client/server and HTTP server handler transports and advanced transport features. labels Feb 24, 2026
@chengxilo chengxilo requested a review from easwars February 26, 2026 07:43
@chengxilo chengxilo marked this pull request as draft February 26, 2026 08:26
@chengxilo chengxilo marked this pull request as ready for review February 26, 2026 08:46
@chengxilo
Copy link
Author

chengxilo commented Feb 26, 2026

Sorry for request a review while a data race detected 🥲. It's solved now.

To clarify my previous commit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Transport Includes HTTP/2 client/server and HTTP server handler transports and advanced transport features. Type: Behavior Change Behavior changes not categorized as bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surface response body when receiving an unexpected status code and content-type

3 participants