mirror of https://github.com/tiangolo/fastapi.git
feat: issue-2008 fix linter
This commit is contained in:
parent
7e11cd5df2
commit
45acd328f2
|
|
@ -931,11 +931,12 @@ class APIRouter(routing.Router):
|
|||
auto_options_index: Optional[int] = None
|
||||
allowed_methods: Set[str] = set()
|
||||
for index, route in enumerate(self.routes):
|
||||
if route.path == new_route.path:
|
||||
if hasattr(route, "is_auto_options") and route.is_auto_options:
|
||||
auto_options_index = index
|
||||
else:
|
||||
allowed_methods.update(route.methods)
|
||||
if isinstance(route, APIRoute):
|
||||
if route.path == new_route.path:
|
||||
if hasattr(route, "is_auto_options") and route.is_auto_options:
|
||||
auto_options_index = index
|
||||
else:
|
||||
allowed_methods.update(route.methods)
|
||||
|
||||
if auto_options_index is not None:
|
||||
self.routes.pop(auto_options_index)
|
||||
|
|
|
|||
Loading…
Reference in New Issue