MCPcopy
hub / github.com/encode/starlette / http_exception

Method http_exception

starlette/middleware/exceptions.py:65–69  ·  starlette/middleware/exceptions.py::ExceptionMiddleware.http_exception
(self, request: Request, exc: Exception)

Source from the content-addressed store, hash-verified

63 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
64
65 async def http_exception(self, request: Request, exc: Exception) -> Response:
66 assert isinstance(exc, HTTPException)
67 if exc.status_code in {204, 304}:
68 return Response(status_code=exc.status_code, headers=exc.headers)
69 return PlainTextResponse(exc.detail, status_code=exc.status_code, headers=exc.headers)
70
71 async def websocket_exception(self, websocket: WebSocket, exc: Exception) -> None:
72 assert isinstance(exc, WebSocketException)

Callers

nothing calls this directly

Calls 2

ResponseClass · 0.90
PlainTextResponseClass · 0.90

Tested by

no test coverage detected