MCPcopy
hub / github.com/fastapi/fastapi / matches

Method matches

fastapi/routing.py:1737–1749  ·  view source on GitHub ↗
(self, scope: Scope)

Source from the content-addressed store, hash-verified

1735 return Match.NONE, {}, None, None
1736
1737 def matches(self, scope: Scope) -> tuple[Match, Scope]:
1738 fastapi_scope = _get_fastapi_scope(scope)
1739 previous_router = fastapi_scope.get(
1740 _FASTAPI_INCLUDED_ROUTER_KEY, _SCOPE_MISSING
1741 )
1742 fastapi_scope[_FASTAPI_INCLUDED_ROUTER_KEY] = self
1743 try:
1744 match, _ = self.original_router.matches(scope)
1745 return match, {}
1746 finally:
1747 _restore_fastapi_scope_key(
1748 scope, _FASTAPI_INCLUDED_ROUTER_KEY, previous_router
1749 )
1750
1751 async def handle(self, scope: Scope, receive: Receive, send: Send) -> None:
1752 _get_fastapi_scope(scope)[_FASTAPI_INCLUDED_ROUTER_KEY] = self

Callers

nothing calls this directly

Calls 4

_get_fastapi_scopeFunction · 0.85
getMethod · 0.45
matchesMethod · 0.45

Tested by

no test coverage detected