File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
test/mcp/server/transports Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -665,7 +665,7 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase
665665 assert body [ "success" ]
666666 end
667667
668- test "stateless mode does not support notifications " do
668+ test "stateless mode does not support server-sent events " do
669669 stateless_transport = StreamableHTTPTransport . new ( @server , stateless : true )
670670
671671 assert_raises ( RuntimeError , "Stateless mode does not support notifications" ) do
@@ -677,6 +677,24 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase
677677 end
678678 end
679679
680+ test "stateless mode responds with 202 when client sends a notification/initialized request" do
681+ stateless_transport = StreamableHTTPTransport . new ( @server , stateless : true )
682+
683+ request = create_rack_request (
684+ "POST" ,
685+ "/" ,
686+ { "CONTENT_TYPE" => "application/json" } ,
687+ { jsonrpc : "2.0" , method : "notifications/initialized" } . to_json ,
688+ )
689+
690+ response = stateless_transport . handle_request ( request )
691+ assert_equal 202 , response [ 0 ]
692+ assert_equal ( { "Content-Type" => "application/json" } , response [ 1 ] )
693+
694+ body = response [ 2 ] [ 0 ]
695+ assert body . blank?
696+ end
697+
680698 test "handle post request with a standard error" do
681699 request = create_rack_request (
682700 "POST" ,
You can’t perform that action at this time.
0 commit comments