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

Method method_not_allowed

starlette/endpoints.py:48–55  ·  view source on GitHub ↗
(self, request: Request)

Source from the content-addressed store, hash-verified

46 await response(self.scope, self.receive, self.send)
47
48 async def method_not_allowed(self, request: Request) -> Response:
49 # If we're running inside a starlette application then raise an
50 # exception, so that the configurable exception handler can deal with
51 # returning the response. For plain ASGI apps, just return the response.
52 headers = {"Allow": ", ".join(self._allowed_methods)}
53 if "app" in self.scope:
54 raise HTTPException(status_code=405, headers=headers)
55 return PlainTextResponse("Method Not Allowed", status_code=405, headers=headers)
56
57
58class WebSocketEndpoint:

Callers

nothing calls this directly

Calls 2

HTTPExceptionClass · 0.90
PlainTextResponseClass · 0.90

Tested by

no test coverage detected