MCPcopy
hub / github.com/fastapi/fastapi / handle

Method handle

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

Source from the content-addressed store, hash-verified

2128 return Match.NONE, {}, None
2129
2130 async def handle(self, scope: Scope, receive: Receive, send: Send) -> None:
2131 effective_context = _get_scope_effective_route_context(scope)
2132 if (
2133 isinstance(effective_context, _EffectiveRouteContext)
2134 and effective_context.original_route is self
2135 ):
2136 prefix = effective_context.frontend_prefix
2137 dependant = effective_context.dependant
2138 dependency_overrides_provider = (
2139 effective_context.dependency_overrides_provider
2140 )
2141 embed_body_fields = effective_context._embed_body_fields
2142 else:
2143 prefix = ""
2144 dependant = self.dependant
2145 dependency_overrides_provider = self.dependency_overrides_provider
2146 embed_body_fields = self._embed_body_fields
2147 match, child_scope, route = self._match(scope, prefix=prefix)
2148 if match == Match.NONE or route is None:
2149 raise HTTPException(status_code=404)
2150 _update_scope(scope, child_scope)
2151 if match == Match.FULL and dependant and dependant.dependencies:
2152 async with self._solve_dependencies(
2153 scope,
2154 receive,
2155 send,
2156 dependant=dependant,
2157 dependency_overrides_provider=dependency_overrides_provider,
2158 embed_body_fields=embed_body_fields,
2159 ):
2160 await route.handle(scope, receive, send)
2161 return
2162 await route.handle(scope, receive, send)
2163
2164 def url_path_for(self, name: str, /, **path_params: Any) -> URLPath:
2165 raise NoMatchFound(name, path_params)

Callers

nothing calls this directly

Calls 6

_matchMethod · 0.95
_solve_dependenciesMethod · 0.95
HTTPExceptionClass · 0.90
_update_scopeFunction · 0.85
handleMethod · 0.45

Tested by

no test coverage detected