forked from phoenix/litellm-mirror
(feat) proxy raise exceptions for different api_key formats
This commit is contained in:
parent
ffdac7b239
commit
df70fd5af5
1 changed files with 2 additions and 2 deletions
|
@ -280,7 +280,7 @@ async def user_api_key_auth(
|
||||||
return UserAPIKeyAuth()
|
return UserAPIKeyAuth()
|
||||||
|
|
||||||
if api_key is None:
|
if api_key is None:
|
||||||
raise Exception("No API Key passed in")
|
raise Exception("No API Key passed in. api_key is None")
|
||||||
if secrets.compare_digest(api_key, MISSING_BEARER):
|
if secrets.compare_digest(api_key, MISSING_BEARER):
|
||||||
# missing 'Bearer ' prefix
|
# missing 'Bearer ' prefix
|
||||||
raise Exception(
|
raise Exception(
|
||||||
|
@ -288,7 +288,7 @@ async def user_api_key_auth(
|
||||||
)
|
)
|
||||||
elif secrets.compare_digest(api_key, NO_API_KEY):
|
elif secrets.compare_digest(api_key, NO_API_KEY):
|
||||||
# no api key passed in
|
# no api key passed in
|
||||||
raise Exception("No API Key passed in. Passed in: {passed_in_key}")
|
raise Exception(f"No API Key passed in. Passed in: {passed_in_key}")
|
||||||
|
|
||||||
route: str = request.url.path
|
route: str = request.url.path
|
||||||
if route == "/user/auth":
|
if route == "/user/auth":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue