mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
feat(pass_through_endpoints.py): raise 404 if passthrough endpoint has been deleted by the user
Ensures passthrough endpoint deletion works as expected (single-instance)
This commit is contained in:
parent
6c4436215c
commit
b4fc7d3cfa
1 changed files with 13 additions and 0 deletions
|
|
@ -974,6 +974,11 @@ def create_pass_through_route(
|
|||
] = None, # if pass-through endpoint is a streaming request
|
||||
subpath: str = "", # captures sub-paths when include_subpath=True
|
||||
):
|
||||
|
||||
from litellm.proxy.pass_through_endpoints.pass_through_endpoints import (
|
||||
InitPassThroughEndpointHelpers,
|
||||
)
|
||||
|
||||
# Construct the full target URL with subpath if needed
|
||||
full_target = (
|
||||
HttpPassThroughEndpointHelpers.construct_target_url_with_subpath(
|
||||
|
|
@ -981,6 +986,14 @@ def create_pass_through_route(
|
|||
)
|
||||
)
|
||||
|
||||
if not InitPassThroughEndpointHelpers.is_registered_pass_through_route(
|
||||
route=endpoint
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail=f"Pass-through endpoint {target} not found. This could have been deleted or not yet added to the proxy.",
|
||||
)
|
||||
|
||||
return await pass_through_request( # type: ignore
|
||||
request=request,
|
||||
target=full_target,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue