(scope: Scope, receive: Receive, send: Send)
| 234 | } |
| 235 | |
| 236 | async def wrapped(scope: Scope, receive: Receive, send: Send) -> None: |
| 237 | path = scope["path"] |
| 238 | if path in overrides: |
| 239 | status, body = overrides[path] |
| 240 | await send( |
| 241 | { |
| 242 | "type": "http.response.start", |
| 243 | "status": status, |
| 244 | "headers": [ |
| 245 | (b"content-type", b"application/json"), |
| 246 | (b"content-length", str(len(body)).encode()), |
| 247 | ], |
| 248 | } |
| 249 | ) |
| 250 | await send({"type": "http.response.body", "body": body}) |
| 251 | return |
| 252 | if path in not_found: |
| 253 | await send({"type": "http.response.start", "status": 404, "headers": []}) |
| 254 | await send({"type": "http.response.body", "body": b""}) |
| 255 | return |
| 256 | await app(scope, receive, send) |
| 257 | |
| 258 | return wrapped |
| 259 |
nothing calls this directly
no test coverage detected