From 81ae1fb9ffd9065a0d4a0bb99343c9d380531e5d Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Thu, 25 Jun 2026 21:45:41 +0200 Subject: [PATCH] Handle missing Connection header in Bedrock signing --- src/anthropic/lib/bedrock/_auth.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/anthropic/lib/bedrock/_auth.py b/src/anthropic/lib/bedrock/_auth.py index 0a8b2109d..a49930db5 100644 --- a/src/anthropic/lib/bedrock/_auth.py +++ b/src/anthropic/lib/bedrock/_auth.py @@ -56,10 +56,9 @@ def get_auth_headers( # The connection header may be stripped by a proxy somewhere, so the receiver # of this message may not see this header, so we remove it from the set of headers # that are signed. - headers = headers.copy() - del headers["connection"] + new_headers = {k: v for k, v in dict(headers).items() if k.lower() != "connection"} - request = AWSRequest(method=method.upper(), url=url, headers=headers, data=data) + request = AWSRequest(method=method.upper(), url=url, headers=new_headers, data=data) credentials = session.get_credentials() if not credentials: raise RuntimeError("could not resolve credentials from session")