mirror of https://github.com/tiangolo/fastapi.git
feat: issue-2008 fix tests
This commit is contained in:
parent
97361b02be
commit
edd8a01536
|
|
@ -840,7 +840,7 @@ class APIRouter(routing.Router):
|
||||||
generate_unique_id_function: Union[
|
generate_unique_id_function: Union[
|
||||||
Callable[[APIRoute], str], DefaultPlaceholder
|
Callable[[APIRoute], str], DefaultPlaceholder
|
||||||
] = Default(generate_unique_id),
|
] = Default(generate_unique_id),
|
||||||
add_auto_options_route: bool = False,
|
add_auto_options_route: Optional[bool] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
route_class = route_class_override or self.route_class
|
route_class = route_class_override or self.route_class
|
||||||
responses = responses or {}
|
responses = responses or {}
|
||||||
|
|
@ -907,7 +907,7 @@ class APIRouter(routing.Router):
|
||||||
|
|
||||||
if "OPTIONS" not in new_route.methods:
|
if "OPTIONS" not in new_route.methods:
|
||||||
|
|
||||||
async def options_route():
|
async def options_route() -> Response:
|
||||||
return Response(headers={"Allow": ", ".join(allowed_methods)})
|
return Response(headers={"Allow": ", ".join(allowed_methods)})
|
||||||
|
|
||||||
self.routes.append(
|
self.routes.append(
|
||||||
|
|
@ -949,7 +949,7 @@ class APIRouter(routing.Router):
|
||||||
generate_unique_id_function: Callable[[APIRoute], str] = Default(
|
generate_unique_id_function: Callable[[APIRoute], str] = Default(
|
||||||
generate_unique_id
|
generate_unique_id
|
||||||
),
|
),
|
||||||
add_auto_options_route: bool = False,
|
add_auto_options_route: Optional[bool] = False,
|
||||||
) -> Callable[[DecoratedCallable], DecoratedCallable]:
|
) -> Callable[[DecoratedCallable], DecoratedCallable]:
|
||||||
def decorator(func: DecoratedCallable) -> DecoratedCallable:
|
def decorator(func: DecoratedCallable) -> DecoratedCallable:
|
||||||
self.add_api_route(
|
self.add_api_route(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue