Skip to content

Commit

Permalink
fix(auth): fix HTTP Basic auth for NOPASS indexes (#8442)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames committed Jan 29, 2021
1 parent 4eaa81a commit 9e09363
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/util/http/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function applyAuthorization(inOptions: GotOptions): GotOptions {
options.headers.authorization = `Bearer ${options.token}`;
}
delete options.token;
} else if (options.password) {
} else if (options.password !== undefined) {
// Otherwise got will add username and password to url and header
const auth = Buffer.from(
`${options.username || ''}:${options.password}`
Expand Down
2 changes: 1 addition & 1 deletion lib/util/http/host-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function applyHostRules(url: string, inOptions: GotOptions): GotOptions {
const { username, password, token, enabled } = foundRules;
if (options.headers?.authorization || options.password || options.token) {
logger.trace({ url }, `Authorization already set`);
} else if (password) {
} else if (password !== undefined) {
logger.trace({ url }, `Applying Basic authentication`);
options.username = username;
options.password = password;
Expand Down

0 comments on commit 9e09363

Please sign in to comment.