Merge pull request #5172 from hardillb/http-request-rejectunauthorized-string

Allow limited Strings for msg.rejectUnauthorized
This commit is contained in:
Nick O'Leary
2025-06-16 14:04:43 +01:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@@ -599,7 +599,18 @@ in your Node-RED user directory (${RED.settings.userDir}).
}
} else {
if (msg.hasOwnProperty('rejectUnauthorized')) {
opts.https = { rejectUnauthorized: msg.rejectUnauthorized };
if (typeof msg.rejectUnauthorized === 'boolean') {
opts.https = { rejectUnauthorized: msg.rejectUnauthorized }
} else if (typeof msg.rejectUnauthorized === 'string') {
if (msg.rejectUnauthorized.toLowerCase() === 'true' || msg.rejectUnauthorized.toLowerCase() === 'false') {
opts.https = { rejectUnauthorized: (msg.rejectUnauthorized.toLowerCase() === 'true') }
} else {
node.warn(RED._("httpin.errors.rejectunauthorized-invalid"))
}
} else {
node.warn(RED._("httpin.errors.rejectunauthorized-invalid"))
}
}
}