|
6 | 6 |
|
7 | 7 | import hypercorn.trio |
8 | 8 | from hypercorn.config import Config |
| 9 | +from hypercorn.typing import ASGIReceiveCallable, ASGISendCallable, Scope |
9 | 10 |
|
10 | 11 |
|
11 | 12 | async def app(scope, receive, send) -> None: # type: ignore |
@@ -58,24 +59,28 @@ async def serve() -> None: |
58 | 59 |
|
59 | 60 |
|
60 | 61 | @pytest.mark.trio |
61 | | -async def test_handle_isolate_state(): |
| 62 | +async def test_handle_isolate_state() -> None: |
62 | 63 | config = Config() |
63 | 64 | config.bind = ["0.0.0.0:1234"] |
64 | 65 | config.accesslog = "-" # Log to stdout/err |
65 | 66 | config.errorlog = "-" |
66 | 67 |
|
67 | | - async def app(scope, receive, send): |
| 68 | + async def app(scope: Scope, receive: ASGIReceiveCallable, send: ASGISendCallable) -> None: |
68 | 69 | assert scope["type"] == "http" |
69 | 70 |
|
70 | 71 | await send( |
71 | 72 | { |
72 | 73 | "type": "http.response.start", |
73 | 74 | "status": 200, |
74 | | - "headers": [[b"content-type", b"text/plain"]], |
| 75 | + "headers": [(b"content-type", b"text/plain")], |
75 | 76 | } |
76 | 77 | ) |
77 | 78 | await send( |
78 | | - {"type": "http.response.body", "body": scope["state"].get("key", b"")} |
| 79 | + { |
| 80 | + "type": "http.response.body", |
| 81 | + "body": scope["state"].get("key", b""), |
| 82 | + "more_body": False, |
| 83 | + } |
79 | 84 | ) |
80 | 85 | scope["state"]["key"] = b"one" |
81 | 86 |
|
|
0 commit comments