Skip to content

Commit

Permalink
Refactor printing registered api routes (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomer Mardan committed Sep 28, 2020
1 parent 161579b commit fb498ac
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/dispatch/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -
# we print all the registered API routes to the console
table = []
for r in api_router.routes:
auth = False
for d in r.dependencies:
if d.dependency.__name__ == "get_current_user": # TODO this is fragile
auth = True
auth = any(d.dependency.__name__ == "get_current_user" for d in r.dependencies) # TODO this is fragile
table.append([r.path, auth, ",".join(r.methods)])

log.debug("Available Endpoints \n" + tabulate(table, headers=["Path", "Authenticated", "Methods"]))

0 comments on commit fb498ac

Please sign in to comment.