Skip to content

mcp_transcoder: handle responses with trailers.#45841

Open
guoyilin42 wants to merge 1 commit into
envoyproxy:mainfrom
guoyilin42:bug
Open

mcp_transcoder: handle responses with trailers.#45841
guoyilin42 wants to merge 1 commit into
envoyproxy:mainfrom
guoyilin42:bug

Conversation

@guoyilin42

Copy link
Copy Markdown
Contributor

Commit Message: mcp_transcoder: handle responses with trailers.
Additional Description:
This PR adds support for transcoding upstream responses with HTTP trailers. The McpJsonRestBridgeFilter::encodeTrailers method is now implemented to properly finalize the response stream:

  • Streaming JSON: If a streaming JSON suffix is configured, the suffix is appended upon the arrival of trailers. If the body chunk was empty, both the streaming JSON prefix and suffix are injected to form a valid empty response envelope.
  • Buffered (Non-Streaming) Body: When trailers arrive, the filter transcodes the response headers using encodeJsonRpcData and flushes the buffered transcoded response body downstream.

Risk Level: Low
Testing: Unit and integ tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Yilin Guo <guoyilin@google.com>
@guoyilin42

Copy link
Copy Markdown
Contributor Author

#44146

@paulhong01

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.

1 participant