Qiao-yq opened a new pull request, #931:
URL: https://github.com/apache/dubbo-go-pixiu/pull/931

   **What this PR does**:
   
   When the MCP filter wraps a backend response into MCP JSON‑RPC format 
(`sendMCPResponse`, JSON path), the new response body is larger than the 
original. However, the old `Content-Length` header from the backend response 
was still copied to the `ResponseWriter`. This caused Go's `net/http` to report 
`http: wrote more than the declared Content-Length` and forcibly close the 
connection.
   
   This PR clears the stale `Content-Length` header by calling 
`ctx.ClearContentLengthHeader()` before returning `filter.Continue` in 
`sendMCPResponse`. This allows `net/http` to automatically calculate the 
correct `Content-Length` from the actual response body, consistent with how 
`sendJSONResponse` and `ErrorHandler.sendResponse` already handle this 
situation.
   
   **Which issue(s) this PR fixes**:
   
   Fixes #(https://github.com/apache/dubbo-go-pixiu-samples/issues/142)
   
   **Special notes for your reviewer**:
   
   - This fix only affects the JSON path (`sendMCPResponse`). The SSE transport 
path is unchanged and continues to work normally.
   - All existing `tools/call` tests pass after this change.
   - Verified manually with MCP Inspector: `tools/call` returns a valid 
JSON‑RPC response.
   
   **Does this PR introduce a user-facing change?**:
   
   ```release-note
   NONE


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to