Browse Source

feat: issue-2008 fix linter

pull/10861/head
Volodymyr Kochetkov 1 year ago
parent
commit
45acd328f2
  1. 11
      fastapi/routing.py

11
fastapi/routing.py

@ -931,11 +931,12 @@ class APIRouter(routing.Router):
auto_options_index: Optional[int] = None auto_options_index: Optional[int] = None
allowed_methods: Set[str] = set() allowed_methods: Set[str] = set()
for index, route in enumerate(self.routes): for index, route in enumerate(self.routes):
if route.path == new_route.path: if isinstance(route, APIRoute):
if hasattr(route, "is_auto_options") and route.is_auto_options: if route.path == new_route.path:
auto_options_index = index if hasattr(route, "is_auto_options") and route.is_auto_options:
else: auto_options_index = index
allowed_methods.update(route.methods) else:
allowed_methods.update(route.methods)
if auto_options_index is not None: if auto_options_index is not None:
self.routes.pop(auto_options_index) self.routes.pop(auto_options_index)

Loading…
Cancel
Save