Fix package.json

Also back out auth changes
This commit is contained in:
Ben Hardill 2021-06-30 14:12:20 +01:00
parent 0e4787f3e8
commit 9db9b53c81
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
3 changed files with 12 additions and 6 deletions

View File

@ -48,7 +48,7 @@
"fs.notify": "0.0.4",
"got": "11.8.2",
"hash-sum": "2.0.0",
"hpagent": "0.1.2",
"hpagent": "^0.1.2",
"https-proxy-agent": "5.0.0",
"i18next": "20.3.2",
"iconv-lite": "0.6.3",

View File

@ -207,17 +207,23 @@ module.exports = function(RED) {
}
if (this.credentials) {
if (this.authType === "basic") {
// Workaround for https://github.com/sindresorhus/got/issues/1169
var cred = ""
var parsedURL = new URL(url)
if (this.credentials.user) {
opts.username = this.credentials.user;
// opts.username = this.credentials.user;
cred = this.credentials.user
} else if (parsedURL.username) {
opts.username = parsedURL.username
cred = parsedURL.username
}
if (this.credentials.password) {
opts.password = this.credentials.password;
// opts.password = this.credentials.password;
cred += ":" + this.credentials.password
} else if (parsedURL.password) {
opts.password = parsedURL.password
cred += ":" + parsedURL.password
}
// build own basic auth header
opts.headers.Authorization = "Basic " + Buffer.from(cred).toString("base64");
} else if (this.authType === "digest") {
let digestCreds = this.credentials;
let sentCreds = false;

View File

@ -31,7 +31,7 @@
"fs.notify": "0.0.4",
"got": "11.8.2",
"hash-sum": "2.0.0",
"hpagent": "0.1.1",
"hpagent": "^0.1.2",
"https-proxy-agent": "5.0.0",
"is-utf8": "0.2.1",
"js-yaml": "3.14.0",