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

Add support for rejectUnauthorized msg property

This commit is contained in:
Nick O'Leary 2018-01-11 22:00:10 +00:00
commit 161c7d30ca
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,9 @@
<dd>If set, can be used to send cookies with the request.</dd> <dd>If set, can be used to send cookies with the request.</dd>
<dt class="optional">payload</dt> <dt class="optional">payload</dt>
<dd>Sent as the body of the request.</dd> <dd>Sent as the body of the request.</dd>
<dt class="optional">rejectUnauthorized</dt>
<dd>If set to <code>true</code>, allows requests to be made to https sites that use
self signed certificates.</dd>
</dl> </dl>
<h3>Outputs</h3> <h3>Outputs</h3>
<dl class="message-properties"> <dl class="message-properties">

View File

@ -196,6 +196,10 @@ module.exports = function(RED) {
} }
if (tlsNode) { if (tlsNode) {
tlsNode.addTLSOptions(opts); tlsNode.addTLSOptions(opts);
} else {
if (msg.hasOwnProperty('rejectUnauthorized')) {
opts.rejectUnauthorized = msg.rejectUnauthorized;
}
} }
var req = ((/^https/.test(urltotest))?https:http).request(opts,function(res) { var req = ((/^https/.test(urltotest))?https:http).request(opts,function(res) {
// Force NodeJs to return a Buffer (instead of a string) // Force NodeJs to return a Buffer (instead of a string)