Skip to content

Commit 582e48f

Browse files
committed
Fix sending Bearer None if not authorized
1 parent 73a72cc commit 582e48f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • src/fastapi_cloud_cli/utils

src/fastapi_cloud_cli/utils/api.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,14 @@ def __init__(self, use_deploy_token: bool = False) -> None:
209209
token = identity.user_token
210210
self.auth_mode = "user"
211211

212+
headers = {"User-Agent": f"fastapi-cloud-cli/{__version__}"}
213+
if token:
214+
headers["Authorization"] = f"Bearer {token}"
215+
212216
super().__init__(
213217
base_url=settings.base_api_url,
214218
timeout=httpx.Timeout(20),
215-
headers={
216-
"Authorization": f"Bearer {token}",
217-
"User-Agent": f"fastapi-cloud-cli/{__version__}",
218-
},
219+
headers=headers,
219220
)
220221

221222
@attempts(STREAM_LOGS_MAX_RETRIES, STREAM_LOGS_TIMEOUT)

0 commit comments

Comments
 (0)