The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: Add headers to Request scope in JWT tests to fix KeyError (#17927)
Alexsander Hamir32fdb9e60e48
diff --git a/tests/proxy_unit_tests/test_jwt.py b/tests/proxy_unit_tests/test_jwt.pyindex b8df16d135b..57434993977 100644--- a/tests/proxy_unit_tests/test_jwt.py+++ b/tests/proxy_unit_tests/test_jwt.py@@ -413,7 +413,7 @@ async def test_team_token_output(prisma_client, audience, monkeypatch):bearer_token = "Bearer " + token- request = Request(scope={"type": "http"})+ request = Request(scope={"type": "http", "headers": []})request._url = URL(url="/chat/completions")## 1. INITIAL TEAM CALL - should fail@@ -446,7 +446,7 @@ async def test_team_token_output(prisma_client, audience, monkeypatch):models=["gpt-3.5-turbo", "gpt-4"],),user_api_key_dict=result,- http_request=Request(scope={"type": "http"}),+ http_request=Request(scope={"type": "http", "headers": []}),)except Exception as e:pytest.fail(f"This should not fail - {str(e)}")@@ -614,7 +614,7 @@ async def aaaatest_user_token_output(bearer_token = "Bearer " + token- request = Request(scope={"type": "http"})+ request = Request(scope={"type": "http", "headers": []})request._url = URL(url="/chat/completions")## 1. INITIAL TEAM CALL - should fail@@ -641,7 +641,7 @@ async def aaaatest_user_token_output(models=["gpt-3.5-turbo", "gpt-4"],),user_api_key_dict=result,- http_request=Request(scope={"type": "http"}),+ http_request=Request(scope={"type": "http", "headers": []}),)if default_team_id:await new_team(@@ -652,7 +652,7 @@ async def aaaatest_user_token_output(models=["gpt-3.5-turbo", "gpt-4"],),user_api_key_dict=result,- http_request=Request(scope={"type": "http"}),+ http_request=Request(scope={"type": "http", "headers": []}),)except Exception as e:pytest.fail(f"This should not fail - {str(e)}")@@ -834,7 +834,7 @@ async def test_allowed_routes_admin(actual_routes.extend(LiteLLMRoutes[route].value)for route in actual_routes:- request = Request(scope={"type": "http"})+ request = Request(scope={"type": "http", "headers": []})request._url = URL(url=route)@@ -999,7 +999,7 @@ async def test_allow_access_by_email(## RUN IT THROUGH USER API KEY AUTHbearer_token = "Bearer " + token- request = Request(scope={"type": "http"})+ request = Request(scope={"type": "http", "headers": []})request._url = URL(url="/chat/completions")