From 44616c6872ffe23220e48a33e822a94da7241679 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 5 Jan 2022 20:56:46 +0000 Subject: [PATCH] Fix basic auth with empty username or password fix for #3324 --- .../node_modules/@node-red/nodes/core/network/21-httprequest.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js index e9bf49d68..f5054eb81 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js +++ b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js @@ -302,6 +302,8 @@ in your Node-RED user directory (${RED.settings.userDir}). // var cred = "" if (this.credentials.user || this.credentials.password) { // cred = `${this.credentials.user}:${this.credentials.password}`; + if (this.credentials.user === undefined) { this.credentials.user = ""} + if (this.credentials.password === undefined) { this.credentials.password = ""} opts.headers.Authorization = "Basic " + Buffer.from(`${this.credentials.user}:${this.credentials.password}`).toString("base64"); } // build own basic auth header