File tree Expand file tree Collapse file tree
tests/server/streamable_http Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -654,7 +654,8 @@ async def sse_writer():
654654 if writer is not None :
655655 with suppress (Exception ):
656656 await writer .send (ClientDisconnect ())
657- response = self ._create_json_response (None , HTTPStatus .ACCEPTED )
657+ # 499 = Client Closed Request (nginx convention, not in stdlib HTTPStatus)
658+ response = self ._create_json_response (None , 499 ) # type: ignore[arg-type]
658659 with suppress (Exception ):
659660 await response (scope , receive , send )
660661 return
Original file line number Diff line number Diff line change @@ -121,9 +121,9 @@ async def dummy_send(message):
121121 assert len (send_calls ) >= 1 , (
122122 f"Expected at least 1 ASGI send (response), got { len (send_calls )} "
123123 )
124- # First send should be http.response.start with 202
124+ # First send should be http.response.start with 499 (Client Closed Request)
125125 assert send_calls [0 ]["type" ] == "http.response.start"
126- assert send_calls [0 ]["status" ] == 202
126+ assert send_calls [0 ]["status" ] == 499
127127
128128 @pytest .mark .anyio
129129 async def test_client_disconnect_notifies_writer (self ):
@@ -202,4 +202,4 @@ async def dummy_send(message):
202202 # Response is still sent even though writer was broken
203203 assert len (send_calls ) >= 1
204204 assert send_calls [0 ]["type" ] == "http.response.start"
205- assert send_calls [0 ]["status" ] == 202
205+ assert send_calls [0 ]["status" ] == 499
You can’t perform that action at this time.
0 commit comments