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

Updates to match Nick's suggestions

This commit is contained in:
Ben Hardill 2020-02-26 19:45:01 +00:00
parent 37bcd5c603
commit 0ca36a89e3
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
3 changed files with 26 additions and 26 deletions

View File

@ -33,11 +33,10 @@
</div> </div>
<div class="form-row node-input-paytoqs-row"> <div class="form-row node-input-paytoqs-row">
<label for="node-input-paytox" style="width: auto" data-i18n="httpin.label.paytoqs"></label> <select id="node-input-paytoqs" style="width: 70%;">
<select id="node-input-paytox"> <option value="ignore" data-i18n="httpin.label.paytoqs.ignore"></option>
<option value="ignore">Ignore</option> <option value="query" data-i18n="httpin.label.paytoqs.query"></option>
<option value="query">Query String</option> <option value="body" data-i18n="httpin.label.paytoqs.body"></option>
<option value="body">Request Body</option>
</select> </select>
</div> </div>
@ -110,7 +109,6 @@
method:{value:"GET"}, method:{value:"GET"},
ret: {value:"txt"}, ret: {value:"txt"},
paytoqs: {value: false}, paytoqs: {value: false},
paytobody: {value: false},
url:{value:"",validate:function(v) { return (v.trim().length === 0) || (v.indexOf("://") === -1) || (v.trim().indexOf("http") === 0)} }, url:{value:"",validate:function(v) { return (v.trim().length === 0) || (v.indexOf("://") === -1) || (v.trim().indexOf("http") === 0)} },
tls: {type:"tls-config",required: false}, tls: {type:"tls-config",required: false},
persist: {value:false}, persist: {value:false},
@ -173,12 +171,16 @@
$(".node-input-paytoqs-row").hide(); $(".node-input-paytoqs-row").hide();
} }
}); });
if (this.paytoqs) { console.log("paytoqs: " + this.paytoqs);
$("#node-input-paytox").val("query"); if (this.paytoqs === true || this.paytoqs == "query") {
} else if (this.paytobody) { $("#node-input-paytoqs").val("query");
$("#node-input-paytox").val("body"); console.log("q");
} else if (this.paytoqs === "body") {
$("#node-input-paytoqs").val("body");
console.log("b");
} else { } else {
$("#node-input-paytox").val("ignore"); $("#node-input-paytoqs").val("ignore");
console.log("i");
} }
if (this.authType) { if (this.authType) {
$('#node-input-useAuth').prop('checked', true); $('#node-input-useAuth').prop('checked', true);
@ -238,18 +240,8 @@
if (!$("#node-input-useProxy").is(":checked")) { if (!$("#node-input-useProxy").is(":checked")) {
$("#node-input-proxy").val("_ADD_"); $("#node-input-proxy").val("_ADD_");
} }
console.log("save - paytoqs " + this.paytoqs);
var payto = $("#node-input-paytox").val(); console.log("save - paytoqs " + $("#node-input-paytoqs").val());
if(payto == "query") {
this.paytoqs = true;
this.paytobody = false;
} else if (payto == "body") {
this.paytoqs = false;
this.paytobody = true;
} else {
this.paytoqs = false;
this.paytobody = false;
}
} }
}); });
</script> </script>

View File

@ -28,8 +28,8 @@ module.exports = function(RED) {
var nodeUrl = n.url; var nodeUrl = n.url;
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 = false;
var paytobody = n.paytobody; var paytobody = false;
var nodeHTTPPersistent = n["persist"]; var nodeHTTPPersistent = n["persist"];
if (n.tls) { if (n.tls) {
var tlsNode = RED.nodes.getNode(n.tls); var tlsNode = RED.nodes.getNode(n.tls);
@ -39,6 +39,10 @@ module.exports = function(RED) {
if (RED.settings.httpRequestTimeout) { this.reqTimeout = parseInt(RED.settings.httpRequestTimeout) || 120000; } if (RED.settings.httpRequestTimeout) { this.reqTimeout = parseInt(RED.settings.httpRequestTimeout) || 120000; }
else { this.reqTimeout = 120000; } else { this.reqTimeout = 120000; }
if (n.paytoqs === true || n.paytoqs === "query") { paytoqs = true; }
else if (n.paytoqs === "body") { paytobody = true; }
var prox, noprox; var prox, noprox;
if (process.env.http_proxy) { prox = process.env.http_proxy; } if (process.env.http_proxy) { prox = process.env.http_proxy; }
if (process.env.HTTP_PROXY) { prox = process.env.HTTP_PROXY; } if (process.env.HTTP_PROXY) { prox = process.env.HTTP_PROXY; }

View File

@ -398,7 +398,11 @@
"status": "Status code", "status": "Status code",
"headers": "Headers", "headers": "Headers",
"other": "other", "other": "other",
"paytoqs" : "Append msg.payload as", "paytoqs" : {
"ignore": "Ignore msg.payload",
"query": "Append msg.payload to query-string parameters",
"body": "Send msg.payload as request Body"
},
"utf8String": "UTF8 string", "utf8String": "UTF8 string",
"binaryBuffer": "binary buffer", "binaryBuffer": "binary buffer",
"jsonObject": "parsed JSON object", "jsonObject": "parsed JSON object",