Skip to content

Commit bcf94f5

Browse files
fix(auth): prioritize first auth header
1 parent 73a49ad commit bcf94f5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/oz_agent_sdk/_client.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ def qs(self) -> Querystring:
128128

129129
@override
130130
def _auth_headers(self, security: SecurityOptions) -> dict[str, str]:
131-
return {
132-
**(self._bearer_auth if security.get("bearer_auth", False) else {}),
133-
}
131+
headers: dict[str, str] = {}
132+
if security.get("bearer_auth", False):
133+
for key, value in self._bearer_auth.items():
134+
headers.setdefault(key, value)
135+
return headers
134136

135137
@property
136138
def _bearer_auth(self) -> dict[str, str]:
@@ -317,9 +319,11 @@ def qs(self) -> Querystring:
317319

318320
@override
319321
def _auth_headers(self, security: SecurityOptions) -> dict[str, str]:
320-
return {
321-
**(self._bearer_auth if security.get("bearer_auth", False) else {}),
322-
}
322+
headers: dict[str, str] = {}
323+
if security.get("bearer_auth", False):
324+
for key, value in self._bearer_auth.items():
325+
headers.setdefault(key, value)
326+
return headers
323327

324328
@property
325329
def _bearer_auth(self) -> dict[str, str]:

0 commit comments

Comments
 (0)