MCPcopy Index your code
hub / github.com/fastapi/fastapi / get_route_handler

Method get_route_handler

fastapi/routing.py:1210–1234  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1208 self.app = request_response(self.get_route_handler())
1209
1210 def get_route_handler(self) -> Callable[[Request], Coroutine[Any, Any, Response]]:
1211 route = cast(_APIRouteLike, self)
1212 # TODO: Replace or deprecate this no-scope hook so included-route
1213 # effective context can be passed explicitly instead of via ContextVar.
1214 effective_context = _effective_route_context_var.get()
1215 if effective_context is not None and effective_context.original_route is self:
1216 route = cast(_APIRouteLike, effective_context)
1217 return get_request_handler(
1218 dependant=route.dependant,
1219 body_field=route.body_field,
1220 status_code=route.status_code,
1221 response_class=route.response_class,
1222 response_field=route.response_field,
1223 response_model_include=route.response_model_include,
1224 response_model_exclude=route.response_model_exclude,
1225 response_model_by_alias=route.response_model_by_alias,
1226 response_model_exclude_unset=route.response_model_exclude_unset,
1227 response_model_exclude_defaults=route.response_model_exclude_defaults,
1228 response_model_exclude_none=route.response_model_exclude_none,
1229 dependency_overrides_provider=route.dependency_overrides_provider,
1230 embed_body_fields=route._embed_body_fields,
1231 strict_content_type=route.strict_content_type,
1232 stream_item_field=route.stream_item_field,
1233 is_json_stream=route.is_json_stream,
1234 )
1235
1236 def matches(self, scope: Scope) -> tuple[Match, Scope]:
1237 effective_context = _get_scope_effective_route_context(scope)

Callers 2

__init__Method · 0.95
handleMethod · 0.95

Calls 2

get_request_handlerFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected