mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-14 02:22:54 +00:00
Fixed incorrect key info endpoint (#13633)
This commit is contained in:
@@ -236,7 +236,7 @@ class KeysManagementClient:
|
||||
UnauthorizedError: If the request fails with a 401 status code
|
||||
requests.exceptions.RequestException: If the request fails with any other error
|
||||
"""
|
||||
url = f"{self._base_url}/keys/info?key={key}"
|
||||
url = f"{self._base_url}/key/info?key={key}"
|
||||
request = requests.Request("GET", url, headers=self._get_headers())
|
||||
|
||||
if return_request:
|
||||
|
||||
@@ -370,7 +370,7 @@ def test_info_request_minimal(client, base_url, api_key):
|
||||
"""Test info request with minimal parameters"""
|
||||
request = client.info(key="test-key", return_request=True)
|
||||
assert request.method == "GET"
|
||||
assert request.url == f"{base_url}/keys/info?key=test-key"
|
||||
assert request.url == f"{base_url}/key/info?key=test-key"
|
||||
assert request.headers["Content-Type"] == "application/json"
|
||||
assert request.headers["Authorization"] == f"Bearer {api_key}"
|
||||
|
||||
@@ -387,7 +387,7 @@ def test_info_mock_response(client):
|
||||
}
|
||||
responses.add(
|
||||
responses.GET,
|
||||
f"{client._base_url}/keys/info?key=test-key",
|
||||
f"{client._base_url}/key/info?key=test-key",
|
||||
json=mock_response,
|
||||
status=200,
|
||||
)
|
||||
@@ -400,7 +400,7 @@ def test_info_unauthorized_error(client):
|
||||
"""Test that info raises UnauthorizedError for 401 responses"""
|
||||
responses.add(
|
||||
responses.GET,
|
||||
f"{client._base_url}/keys/info?key=test-key",
|
||||
f"{client._base_url}/key/info?key=test-key",
|
||||
status=401,
|
||||
json={"error": "Unauthorized"},
|
||||
)
|
||||
@@ -413,7 +413,7 @@ def test_info_server_error(client):
|
||||
"""Test that info raises HTTPError for server errors"""
|
||||
responses.add(
|
||||
responses.GET,
|
||||
f"{client._base_url}/keys/info?key=test-key",
|
||||
f"{client._base_url}/key/info?key=test-key",
|
||||
status=500,
|
||||
json={"error": "Internal Server Error"},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user