Skip to content

Commit

Permalink
Extract into helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwann committed Dec 14, 2023
1 parent 96b7191 commit f89082c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions connexion/middleware/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
scope.get("path_params", {})
)

api_base_path = scope.get("route_root_path", scope.get("root_path", ""))[
len(
original_scope.get(
"route_root_path", original_scope.get("root_path", "")
)
) :
]
def get_root_path(scope: Scope) -> str:
return scope.get("route_root_path", scope.get("root_path", ""))

api_base_path = get_root_path(scope)[len(get_root_path(original_scope)) :]

extensions = original_scope.setdefault("extensions", {})
connexion_routing = extensions.setdefault(ROUTING_CONTEXT, {})
Expand Down

0 comments on commit f89082c

Please sign in to comment.