Skip to content

Commit 62eaed0

Browse files
refac(auth): only add auth headers for auth server if auth is non empty
Signed-off-by: whatsacomputertho <[email protected]>
1 parent 80af3ae commit 62eaed0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

image/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def get_auth_token(
139139
response, and MUST include the www-authenticate header
140140
141141
Args:
142-
res (Type[requests.Response]): The response from the registry API
142+
res (requests.Response): The response from the registry API
143143
reg_auth (str): The auth retrieved for the registry
144144
145145
Returns:
@@ -168,9 +168,11 @@ def get_auth_token(
168168

169169
# Send the request to the auth service, parse the token from the
170170
# response
171-
headers = {
172-
'Authorization': f"Basic {reg_auth}"
173-
}
171+
headers = {}
172+
if len(reg_auth) > 0:
173+
headers = {
174+
'Authorization': f"Basic {reg_auth}"
175+
}
174176
token_res = requests.get(auth_url, headers=headers)
175177
token_res.raise_for_status()
176178
token_json = token_res.json()

0 commit comments

Comments
 (0)