Add websocket 500 fallback header test (#2874)

## Summary
- extend the invalid websocket HTTP response regression test
- assert the 500 fallback includes content-length and connection headers

## Testing
- uv run pytest tests/protocols/test_websocket.py -k invalid_status -q
This commit is contained in:
Marcelo Trylesinski 2026-03-28 11:09:29 +01:00 committed by GitHub
parent 28efbb24bd
commit 1cb8e747e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -883,6 +883,8 @@ async def test_server_reject_connection_with_invalid_status(
response = await wsresponse(url)
assert response.status_code == 500
assert response.content == b"Internal Server Error"
assert response.headers["content-length"] == "21"
assert response.headers["connection"] == "close"
config = Config(app=app, ws=ws_protocol_cls, http=http_protocol_cls, lifespan="off", port=unused_tcp_port)
async with run_server(config):