(scope: Scope, receive: Receive, send: Send)
| 161 | |
| 162 | |
| 163 | async def echo_headers(scope: Scope, receive: Receive, send: Send) -> None: |
| 164 | body = { |
| 165 | name.capitalize().decode(): value.decode() |
| 166 | for name, value in scope.get("headers", []) |
| 167 | } |
| 168 | await send( |
| 169 | { |
| 170 | "type": "http.response.start", |
| 171 | "status": 200, |
| 172 | "headers": [[b"content-type", b"application/json"]], |
| 173 | } |
| 174 | ) |
| 175 | await send({"type": "http.response.body", "body": json.dumps(body).encode()}) |
| 176 | |
| 177 | |
| 178 | async def redirect_301(scope: Scope, receive: Receive, send: Send) -> None: |