A route may be used in isolation as a stand-alone ASGI app. This is a somewhat contrived case, as they'll almost always be used within a Router, but could be useful for some tooling and minimal apps.
(self, scope: Scope, receive: Receive, send: Send)
| 177 | raise NotImplementedError() # pragma: no cover |
| 178 | |
| 179 | async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: |
| 180 | """ |
| 181 | A route may be used in isolation as a stand-alone ASGI app. |
| 182 | This is a somewhat contrived case, as they'll almost always be used |
| 183 | within a Router, but could be useful for some tooling and minimal apps. |
| 184 | """ |
| 185 | match, child_scope = self.matches(scope) |
| 186 | if match == Match.NONE: |
| 187 | if scope["type"] == "http": |
| 188 | response = PlainTextResponse("Not Found", status_code=404) |
| 189 | await response(scope, receive, send) |
| 190 | elif scope["type"] == "websocket": # pragma: no branch |
| 191 | websocket_close = WebSocketClose() |
| 192 | await websocket_close(scope, receive, send) |
| 193 | return |
| 194 | |
| 195 | scope.update(child_scope) |
| 196 | await self.handle(scope, receive, send) |
| 197 | |
| 198 | |
| 199 | class Route(BaseRoute): |
nothing calls this directly
no test coverage detected