diff --git a/sanic/models/protocol_types.py b/sanic/models/protocol_types.py index 85d8343bdd..14bc275cbf 100644 --- a/sanic/models/protocol_types.py +++ b/sanic/models/protocol_types.py @@ -2,6 +2,8 @@ from typing import Any, AnyStr, TypeVar, Union +from sanic.models.asgi import ASGIScope + if sys.version_info < (3, 8): from asyncio import BaseTransport @@ -17,6 +19,8 @@ from typing import Protocol class TransportProtocol(Protocol): + scope: ASGIScope + def get_protocol(self): ... diff --git a/tests/test_requests.py b/tests/test_requests.py index 84d6380e80..4d7fb0aa13 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -1051,7 +1051,6 @@ async def handler(request): assert request.form.get("test") == "" # For request.parsed_form - def test_post_form_urlencoded_drop_blanks(app): @app.route("/", methods=["POST"]) async def handler(request): @@ -1066,6 +1065,7 @@ async def handler(request): assert "test" not in request.form.keys() + @pytest.mark.asyncio async def test_post_form_urlencoded_drop_blanks_asgi(app): @app.route("/", methods=["POST"])