@@ -243,13 +243,17 @@ async fn stateless_negotiated_terminal_response_returns_application_json() -> an
243243 Ok ( ( ) )
244244}
245245
246+ #[ rstest:: rstest]
246247#[ tokio:: test]
247- async fn stateless_negotiated_header_mismatch_returns_bad_request ( ) -> anyhow:: Result < ( ) > {
248+ async fn stateless_negotiated_header_mismatch_returns_bad_request (
249+ #[ values( false , true ) ] json_response : bool ,
250+ #[ values( false , true ) ] legacy_session_mode : bool ,
251+ ) -> anyhow:: Result < ( ) > {
248252 let ct = CancellationToken :: new ( ) ;
249253 let ( client, url, ct) = spawn_progress_server (
250254 StreamableHttpServerConfig :: default ( )
251- . with_legacy_session_mode ( false )
252- . with_json_response ( true )
255+ . with_legacy_session_mode ( legacy_session_mode )
256+ . with_json_response ( json_response )
253257 . with_sse_keep_alive ( None )
254258 . with_cancellation_token ( ct. child_token ( ) ) ,
255259 )
@@ -267,9 +271,14 @@ async fn stateless_negotiated_header_mismatch_returns_bad_request() -> anyhow::R
267271 . await ?;
268272
269273 assert_eq ! ( response. status( ) , 400 ) ;
274+ assert_eq ! ( response. headers( ) [ "content-type" ] , "application/json" ) ;
270275 let body: serde_json:: Value = response. json ( ) . await ?;
271276 assert_eq ! ( body[ "id" ] , 3 ) ;
272277 assert_eq ! ( body[ "error" ] [ "code" ] , -32020 ) ;
278+ assert_eq ! (
279+ body[ "error" ] [ "message" ] ,
280+ "header does not match request parameter"
281+ ) ;
273282
274283 ct. cancel ( ) ;
275284 Ok ( ( ) )
0 commit comments