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