Skip to content

Fix gRPC status details trailer handling#4229

Open
hutiefang76 wants to merge 1 commit into
spring-cloud:mainfrom
hutiefang76:codex/gateway-4224-grpc-status-details
Open

Fix gRPC status details trailer handling#4229
hutiefang76 wants to merge 1 commit into
spring-cloud:mainfrom
hutiefang76:codex/gateway-4224-grpc-status-details

Conversation

@hutiefang76

Copy link
Copy Markdown

Fixes gh-4224

This preserves grpc-status-details-bin when GRPCResponseHeadersFilter moves a trailers-only gRPC response status into Reactor Netty trailer headers.

Previously the immediate error path copied only grpc-status and grpc-message. grpc-status-details-bin is also gRPC trailer metadata, so clients lost the rich error details for trailers-only responses.

Changes:

  • copy grpc-status-details-bin into the trailer headers when present
  • add a focused unit test that captures the Reactor Netty trailerHeaders consumer and verifies grpc-status, grpc-message, and grpc-status-details-bin

Verification:

  • RED: GRPCResponseHeadersFilterTests.shouldIncludeGrpcStatusDetailsBinTrailerIfGRPC failed before the fix because grpc-status-details-bin was null
  • GREEN: JAVA_HOME=/Users/hutiefang/Library/Java/JavaVirtualMachines/ms-17.0.18/Contents/Home ./mvnw -pl spring-cloud-gateway-server-webflux -Dtest=GRPCResponseHeadersFilterTests test
  • Related tests: same command with -Dtest=GRPCRequestHeadersFilterTest,GRPCResponseHeadersFilterTests passed 3 tests
  • Format: JAVA_HOME=/Users/hutiefang/Library/Java/JavaVirtualMachines/ms-17.0.18/Contents/Home ./mvnw -pl spring-cloud-gateway-server-webflux spring-javaformat:validate
  • git diff --check

Signed-off-by: hutiefang <hutiefang@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: GRPCResponseHeadersFilter drops grpc-status-details-bin on trailers-only responses

2 participants