MCPcopy
hub / github.com/fastapi/fastapi / _handle_selected

Method _handle_selected

fastapi/routing.py:1755–1775  ·  view source on GitHub ↗
(
        self, scope: Scope, receive: Receive, send: Send
    )

Source from the content-addressed store, hash-verified

1753 await self.original_router.handle(scope, receive, send)
1754
1755 async def _handle_selected(
1756 self, scope: Scope, receive: Receive, send: Send
1757 ) -> None:
1758 match, child_scope, route, effective_context = self._match(scope)
1759 if match == Match.NONE or route is None:
1760 await self.original_router.default(scope, receive, send)
1761 return
1762 scope.update(child_scope)
1763 if isinstance(route, _IncludedRouter):
1764 await route.handle(scope, receive, send)
1765 return
1766 if effective_context is not None:
1767 _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = (
1768 effective_context
1769 )
1770 original_route = effective_context.original_route
1771 if isinstance(original_route, APIRoute):
1772 scope["route"] = original_route
1773 await original_route.handle(scope, receive, send)
1774 return
1775 await route.handle(scope, receive, send)
1776
1777 def effective_route_contexts(self) -> Iterator[_EffectiveRouteContext]:
1778 for candidate in self.effective_candidates():

Calls 4

_matchMethod · 0.95
_get_fastapi_scopeFunction · 0.85
defaultMethod · 0.80
handleMethod · 0.45