Skip to content

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]

Fix test_vertex_passthrough_forwards_anthropic_beta_header

Sameer Kankute8f8ebbec8d96
diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py b/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py
index d2fdb157c8d..eb4749549c2 100644
--- a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py
+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py
@@ -253,6 +253,9 @@ async def test_vertex_passthrough_forwards_anthropic_beta_header():
"content-length": "1234", # Should be removed
"host": "localhost:4000", # Should be removed
})
+ # Prevent MagicMock from auto-creating a truthy _cached_headers attribute,
+ # which would short-circuit _safe_get_request_headers before reading .headers
+ mock_request.state._cached_headers = None
# Create mock vertex credentials
mock_vertex_credentials = MagicMock()