Skip to content

Commit 61fb929

Browse files
fix(client): loosen auth header validation
1 parent 004c50f commit 61fb929

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/finch/_client.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,7 @@ def default_headers(self) -> dict[str, str | Omit]:
239239

240240
@override
241241
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
242-
if self.access_token and headers.get("Authorization"):
243-
return
244-
if isinstance(custom_headers.get("Authorization"), Omit):
245-
return
246-
247-
if self.client_id and self.client_secret and headers.get("Authorization"):
248-
return
249-
if isinstance(custom_headers.get("Authorization"), Omit):
242+
if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit):
250243
return
251244

252245
raise TypeError(
@@ -589,14 +582,7 @@ def default_headers(self) -> dict[str, str | Omit]:
589582

590583
@override
591584
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
592-
if self.access_token and headers.get("Authorization"):
593-
return
594-
if isinstance(custom_headers.get("Authorization"), Omit):
595-
return
596-
597-
if self.client_id and self.client_secret and headers.get("Authorization"):
598-
return
599-
if isinstance(custom_headers.get("Authorization"), Omit):
585+
if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit):
600586
return
601587

602588
raise TypeError(

0 commit comments

Comments
 (0)