MCPcopy Create free account
hub / github.com/encode/starlette / not_found

Method not_found

starlette/routing.py:622–635  ·  view source on GitHub ↗
(self, scope: Scope, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

620 self.middleware_stack = RequestBodyLimitMiddleware(self.middleware_stack, max_body_size=max_body_size)
621
622 async def not_found(self, scope: Scope, receive: Receive, send: Send) -> None:
623 if scope["type"] == "websocket":
624 websocket_close = WebSocketClose()
625 await websocket_close(scope, receive, send)
626 return
627
628 # If we're running inside a starlette application then raise an
629 # exception, so that the configurable exception handler can deal with
630 # returning the response. For plain ASGI apps, just return the response.
631 if "app" in scope:
632 raise HTTPException(status_code=404)
633 else:
634 response = PlainTextResponse("Not Found", status_code=404)
635 await response(scope, receive, send)
636
637 def url_path_for(self, name: str, /, **path_params: Any) -> URLPath:
638 for route in self.routes:

Callers

nothing calls this directly

Calls 3

WebSocketCloseClass · 0.90
HTTPExceptionClass · 0.90
PlainTextResponseClass · 0.90

Tested by

no test coverage detected