fix(agentic-ai): update Content-Type assertion for mcp-sdk 1.1.2#7070
Conversation
mcp-sdk 1.1.2 now appends '; charset=UTF-8' to the Content-Type header on POST requests. Switch the WireMock assertion from equalTo() to containing() so the test accepts both forms. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates Agentic-AI MCP SDK client factory tests to tolerate the Content-Type header change introduced by mcp-sdk 1.1.2 (application/json → application/json; charset=UTF-8), preventing CI failures on the dependency bump.
Changes:
- Relax WireMock
Content-Typerequest-header assertion from strict equality to substring matching forapplication/json. - Add WireMock
containing(...)static import used by the updated assertion.
| postRequestedFor(urlPathEqualTo(endpoint)) | ||
| .withHeader("Content-Type", equalTo("application/json")) | ||
| .withHeader("Content-Type", containing("application/json")) | ||
| .withHeader("Accept", equalTo("application/json, text/event-stream")) |
There was a problem hiding this comment.
Using containing("application/json") makes the assertion quite permissive (it would also pass for unexpected values like application/jsonp or other strings that happen to include that substring). Consider using a stricter matcher that still allows the optional ; charset=... parameter (e.g., a regex that matches application/json with optional parameters) so the test continues to validate the media type while remaining compatible with mcp-sdk 1.1.2+.
|
Successfully created backport PR for |
…) (#7073) mcp-sdk 1.1.2 now appends '; charset=UTF-8' to the Content-Type header on POST requests. Switch the WireMock assertion from equalTo() to containing() so the test accepts both forms. (cherry picked from commit c99eb1f) Co-authored-by: Pavel Kotelevskii <38818382+chillleader@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🎉 This pull request has been included in release Thank you for your contribution! 🚀 |
|
🎉 This pull request has been included in release Thank you for your contribution! 🚀 |
Summary
; charset=UTF-8to theContent-Typeheader on HTTP POST requests, changing it fromapplication/jsontoapplication/json; charset=UTF-8.McpSdkClientFactoryTest.createsStreamableHttpMcpClientused a strictequalTo("application/json")WireMock assertion, causing all three parameterised test cases (/mcp,/mcp/cluster,/abc123/mcp/cluster) to fail in CI on that PR.containing("application/json")so it accepts both forms.Changes
McpSdkClientFactoryTest.java— one line changed + import added.Testing
This fix should be cherry-picked / merged into #7039 (or that PR rebased on top of this) to unblock the Renovate bump.