(scope, receive, send)
| 46 | |
| 47 | |
| 48 | async def echo_headers(scope, receive, send): |
| 49 | status = 200 |
| 50 | output = json.dumps( |
| 51 | {"headers": [[k.decode(), v.decode()] for k, v in scope["headers"]]} |
| 52 | ).encode("utf-8") |
| 53 | headers = [(b"content-type", "text/plain"), (b"content-length", str(len(output)))] |
| 54 | |
| 55 | await send({"type": "http.response.start", "status": status, "headers": headers}) |
| 56 | await send({"type": "http.response.body", "body": output}) |
| 57 | |
| 58 | |
| 59 | async def raise_exc(scope, receive, send): |