@@ -1465,6 +1465,45 @@ def string
14651465 assert_equal 200 , response [ 0 ]
14661466 end
14671467
1468+ test "POST request with mixed-case Accept header succeeds" do
1469+ request = create_rack_request_without_accept (
1470+ "POST" ,
1471+ "/" ,
1472+ {
1473+ "CONTENT_TYPE" => "application/json" ,
1474+ "HTTP_ACCEPT" => "Application/JSON, Text/Event-Stream" ,
1475+ } ,
1476+ { jsonrpc : "2.0" , method : "initialize" , id : "123" } . to_json ,
1477+ )
1478+
1479+ response = @transport . handle_request ( request )
1480+ assert_equal 200 , response [ 0 ]
1481+ end
1482+
1483+ test "GET request with upper-case Accept header succeeds" do
1484+ init_request = create_rack_request (
1485+ "POST" ,
1486+ "/" ,
1487+ { "CONTENT_TYPE" => "application/json" } ,
1488+ { jsonrpc : "2.0" , method : "initialize" , id : "123" } . to_json ,
1489+ )
1490+ init_response = @transport . handle_request ( init_request )
1491+ session_id = init_response [ 1 ] [ "Mcp-Session-Id" ]
1492+
1493+ request = create_rack_request_without_accept (
1494+ "GET" ,
1495+ "/" ,
1496+ {
1497+ "HTTP_ACCEPT" => "TEXT/EVENT-STREAM" ,
1498+ "HTTP_MCP_SESSION_ID" => session_id ,
1499+ } ,
1500+ )
1501+
1502+ response = @transport . handle_request ( request )
1503+ assert_equal 200 , response [ 0 ]
1504+ assert_equal "text/event-stream" , response [ 1 ] [ "Content-Type" ]
1505+ end
1506+
14681507 test "GET request without Accept header returns 406" do
14691508 init_request = create_rack_request (
14701509 "POST" ,
0 commit comments