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

Update 21-httprequest.js

Adding HTTP persistent definition and function
This commit is contained in:
Ibrahim Al-Mahfooz 2019-08-09 21:23:28 +03:00 committed by GitHub
parent 78bee3dc59
commit 4d60447242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,7 @@ module.exports = function(RED) {
var isTemplatedUrl = (nodeUrl||"").indexOf("{{") != -1; var isTemplatedUrl = (nodeUrl||"").indexOf("{{") != -1;
var nodeMethod = n.method || "GET"; var nodeMethod = n.method || "GET";
var paytoqs = n.paytoqs; var paytoqs = n.paytoqs;
var nodeHTTPPersistent = n["http-persistent"];
if (n.tls) { if (n.tls) {
var tlsNode = RED.nodes.getNode(n.tls); var tlsNode = RED.nodes.getNode(n.tls);
} }
@ -94,6 +95,7 @@ module.exports = function(RED) {
opts.maxRedirects = 21; opts.maxRedirects = 21;
opts.jar = request.jar(); opts.jar = request.jar();
opts.proxy = null; opts.proxy = null;
opts.forever = nodeHTTPPersistent;
if (msg.requestTimeout !== undefined) { if (msg.requestTimeout !== undefined) {
if (isNaN(msg.requestTimeout)) { if (isNaN(msg.requestTimeout)) {
node.warn(RED._("httpin.errors.timeout-isnan")); node.warn(RED._("httpin.errors.timeout-isnan"));