1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Bump hpagent to 0.1.2

Also remove workaround for empty proxy credentials
This commit is contained in:
Ben Hardill 2021-06-30 13:42:56 +01:00
parent f8d8d4b186
commit 0e4787f3e8
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
2 changed files with 5 additions and 11 deletions

View File

@ -48,7 +48,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",
"i18next": "20.3.2",
"iconv-lite": "0.6.3",

View File

@ -207,23 +207,17 @@ 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;
cred = this.credentials.user
opts.username = this.credentials.user;
} else if (parsedURL.username) {
cred = parsedURL.username
opts.username = parsedURL.username
}
if (this.credentials.password) {
// opts.password = this.credentials.password;
cred += ":" + this.credentials.password
opts.password = this.credentials.password;
} else if (parsedURL.password) {
cred += ":" + parsedURL.password
opts.password = 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;