mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 15:34:26 +01:00
Allow limited Strings for msg.rejectUnauthorized
fixes #5171 If `msg.rejectUnauthorized` is a string allow "true", "false" (and upper case versions) otherwise show a warning and use default behaviour. Boolean values used as is, any other types also ignored.
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -563,7 +563,8 @@
|
||||
"timeout-isnan": "Timeout value is not a valid number, ignoring",
|
||||
"timeout-isnegative": "Timeout value is negative, ignoring",
|
||||
"invalid-payload": "Invalid payload",
|
||||
"invalid-url": "Invalid url"
|
||||
"invalid-url": "Invalid url",
|
||||
"rejectunauthorized-invalid": "msg.rejectUnauthorized should be a boolean"
|
||||
},
|
||||
"status": {
|
||||
"requesting": "requesting"
|
||||
|
||||
Reference in New Issue
Block a user