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

Method method_not_allowed

starlette/endpoints.py:48–55  ·  starlette/endpoints.py::HTTPEndpoint.method_not_allowed
(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 class="cm"># If we're running inside a starlette application then raise an
50 class="cm"># exception, so that the configurable exception handler can deal with
51 class="cm"># returning the response. For plain ASGI apps, just return the response.
52 headers = {class="st">"Allow": class="st">", ".join(self._allowed_methods)}
53 if class="st">"app" in self.scope:
54 raise HTTPException(status_code=405, headers=headers)
55 return PlainTextResponse(class="st">"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