(scope: Scope, receive: Receive, send: Send)
| 111 | |
| 112 | |
| 113 | async def status_code(scope: Scope, receive: Receive, send: Send) -> None: |
| 114 | status_code = int(scope["path"].replace("/status/", "")) |
| 115 | await send( |
| 116 | { |
| 117 | "type": "http.response.start", |
| 118 | "status": status_code, |
| 119 | "headers": [[b"content-type", b"text/plain"]], |
| 120 | } |
| 121 | ) |
| 122 | await send({"type": "http.response.body", "body": b"Hello, world!"}) |
| 123 | |
| 124 | |
| 125 | async def echo_body(scope: Scope, receive: Receive, send: Send) -> None: |