(http_protocol_cls: type[HTTPProtocol], name: str)
| 331 | ], |
| 332 | ) |
| 333 | async def test_invalid_header_name(http_protocol_cls: type[HTTPProtocol], name: str): |
| 334 | app = Response("Hello, world", media_type="text/plain", headers={name: "value"}) |
| 335 | protocol = get_connected_protocol(app, http_protocol_cls) |
| 336 | protocol.data_received(SIMPLE_GET_REQUEST) |
| 337 | await protocol.loop.run_one() |
| 338 | # No 500 is sent because `response_started` is set before header validation, |
| 339 | # so the error handler just closes the connection. |
| 340 | assert b"HTTP/1.1 500 Internal Server Error" not in protocol.transport.buffer |
| 341 | assert name.encode() not in protocol.transport.buffer |
| 342 | assert protocol.transport.is_closing() |
| 343 | |
| 344 | |
| 345 | @pytest.mark.parametrize("path", ["/", "/?foo", "/?foo=bar", "/?foo=bar&baz=1"]) |
nothing calls this directly
no test coverage detected