mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-17 04:26:20 +00:00
fix get_request_route
This commit is contained in:
committed by
Krrish Dholakia
parent
68f245c964
commit
775ef8a786
@@ -86,10 +86,16 @@ def get_request_route(request: Request) -> str:
|
||||
|
||||
remove base url from path if set e.g. `/genai/chat/completions` -> `/chat/completions
|
||||
"""
|
||||
if request.url.path.startswith(request.base_url.path):
|
||||
# remove base_url from path
|
||||
return request.url.path[len(request.base_url.path) - 1 :]
|
||||
else:
|
||||
try:
|
||||
if request.url.path.startswith(request.base_url.path):
|
||||
# remove base_url from path
|
||||
return request.url.path[len(request.base_url.path) - 1 :]
|
||||
else:
|
||||
return request.url.path
|
||||
except Exception as e:
|
||||
verbose_proxy_logger.warning(
|
||||
f"error on get_request_route: {str(e)}, defaulting to request.url.path"
|
||||
)
|
||||
return request.url.path
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user