mcp: accept parameterized Content-Type types (#890)
Use a shared helper for Content-Type parsing in streamable transport request validation and client response handling. Follow up to https://github.com/modelcontextprotocol/go-sdk/pull/853, where we did this for `Accept` headers. This allows the streamable mcp server to validate the following header `Content-Type: application/json;charset=utf-8` Co-authored-by: Maciej Kisiel <mkisiel@google.com>
This commit is contained in:
parent
b37e497f0a
commit
35f1b07e48
1 changed files with 40 additions and 12 deletions
|
|
@ -264,6 +264,7 @@ func TestStreamableClientGETHandling(t *testing.T) {
|
|||
contentType string
|
||||
}{
|
||||
{http.StatusOK, "", "text/event-stream"},
|
||||
{http.StatusOK, "", "text/event-stream; charset=utf-8"},
|
||||
{http.StatusMethodNotAllowed, "", "text/event-stream"},
|
||||
//// The client error status code is not treated as an error in non-strict
|
||||
//// mode.
|
||||
|
|
@ -274,7 +275,7 @@ func TestStreamableClientGETHandling(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(fmt.Sprintf("status=%d", test.status), func(t *testing.T) {
|
||||
t.Run(fmt.Sprintf("status=%d content_type=%q", test.status, test.contentType), func(t *testing.T) {
|
||||
fake := &fakeStreamableServer{
|
||||
t: t,
|
||||
responses: fakeResponses{
|
||||
|
|
|
|||
Loading…
Reference in a new issue