mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
test_should_not_fail_with_forwarded_headers_bedrock_invoke_messages
This commit is contained in:
parent
0a0b0b21bb
commit
8129b8d91a
1 changed files with 40 additions and 0 deletions
|
|
@ -99,3 +99,43 @@ async def test_anthropic_messages_bedrock_converse_with_thinking():
|
|||
# Verify response
|
||||
INSTANCE_BASE_ANTHROPIC_MESSAGES_TEST._validate_response(response)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_should_not_fail_with_forwarded_headers_bedrock_invoke_messages():
|
||||
"""
|
||||
E2E test for Bedrock invoke messages with header forwarding enabled.
|
||||
This calls the real Bedrock endpoint (no mocks) and should not raise
|
||||
SigV4 signature mismatch errors when forwarded headers are present.
|
||||
"""
|
||||
router = Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "claude-sonnet-4-5-20250929",
|
||||
"litellm_params": {
|
||||
"model": "bedrock/invoke/us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
"aws_region_name": os.getenv("AWS_REGION_NAME"),
|
||||
},
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
forwarded_headers = {
|
||||
"x-forwarded-for": "10.11.232.194",
|
||||
"x-forwarded-port": "443",
|
||||
"x-forwarded-proto": "https",
|
||||
"x-app": "cli",
|
||||
}
|
||||
|
||||
response = await router.aanthropic_messages(
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
model="claude-sonnet-4-5-20250929",
|
||||
max_tokens=5,
|
||||
stream=False,
|
||||
headers=forwarded_headers, # simulates forward_client_headers_to_llm_api
|
||||
aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
|
||||
aws_secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
|
||||
aws_region_name=os.getenv("AWS_REGION_NAME"),
|
||||
)
|
||||
print("INVOKE API RESPONSE: ", response)
|
||||
|
||||
INSTANCE_BASE_ANTHROPIC_MESSAGES_TEST._validate_response(response)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue