diff --git a/fastapi/routing.py b/fastapi/routing.py index c97668a75c..d043d809d6 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -979,9 +979,7 @@ class APIRoute(routing.Route): @property def is_json_stream(self) -> bool: - return self.is_generator and isinstance( - self.response_class, DefaultPlaceholder - ) + return self.is_generator and isinstance(self.response_class, DefaultPlaceholder) @cached_property def _flat_dependant(self) -> Dependant: @@ -1013,7 +1011,6 @@ class APIRoute(routing.Route): _ = self.response_fields _ = self.stream_item_field - def get_route_handler(self) -> Callable[[Request], Coroutine[Any, Any, Response]]: return get_request_handler( dependant=self.dependant, diff --git a/tests/test_route_deferred_init.py b/tests/test_route_deferred_init.py index 17e9274259..0514eee8fe 100644 --- a/tests/test_route_deferred_init.py +++ b/tests/test_route_deferred_init.py @@ -11,6 +11,7 @@ deferred_keys = [ "response_fields", "body_field", "response_field", + "stream_item_field", "dependant", "_flat_dependant", "_embed_body_fields",