From edd8a015362a8417fa690e4d4c290471af447293 Mon Sep 17 00:00:00 2001 From: Volodymyr Kochetkov Date: Thu, 28 Dec 2023 11:31:42 +0200 Subject: [PATCH] feat: issue-2008 fix tests --- fastapi/routing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index e4b84e6cb..b86675202 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -840,7 +840,7 @@ class APIRouter(routing.Router): generate_unique_id_function: Union[ Callable[[APIRoute], str], DefaultPlaceholder ] = Default(generate_unique_id), - add_auto_options_route: bool = False, + add_auto_options_route: Optional[bool] = False, ) -> None: route_class = route_class_override or self.route_class responses = responses or {} @@ -907,7 +907,7 @@ class APIRouter(routing.Router): if "OPTIONS" not in new_route.methods: - async def options_route(): + async def options_route() -> Response: return Response(headers={"Allow": ", ".join(allowed_methods)}) self.routes.append( @@ -949,7 +949,7 @@ class APIRouter(routing.Router): generate_unique_id_function: Callable[[APIRoute], str] = Default( generate_unique_id ), - add_auto_options_route: bool = False, + add_auto_options_route: Optional[bool] = False, ) -> Callable[[DecoratedCallable], DecoratedCallable]: def decorator(func: DecoratedCallable) -> DecoratedCallable: self.add_api_route(