Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mcp/streamable.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque
http.Error(w, "Accept must contain 'text/event-stream' for GET requests", http.StatusBadRequest)
return
}
} else if !jsonOK || !streamOK {
} else if (!jsonOK || !streamOK) && req.Method != http.MethodDelete { // TODO: consolidate with handling of http method below.
http.Error(w, "Accept must contain both 'application/json' and 'text/event-stream'", http.StatusBadRequest)
return
}
Expand Down
7 changes: 7 additions & 0 deletions mcp/streamable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,13 @@ func TestStreamableServerTransport(t *testing.T) {
},
wantSessionID: true,
},
{
method: "DELETE",
wantStatusCode: http.StatusNoContent,
// Delete request expects 204 No Content with empty body. So override
// the default "accept: application/json, text/event-stream" header.
headers: map[string][]string{"Accept": nil},
},
},
},
{
Expand Down