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

View File

@ -28,8 +28,8 @@ module.exports = function(RED) {
var nodeUrl = n.url;
var isTemplatedUrl = (nodeUrl||"").indexOf("{{") != -1;
var nodeMethod = n.method || "GET";
var paytoqs = n.paytoqs;
var paytobody = n.paytobody;
var paytoqs = false;
var paytobody = false;
var nodeHTTPPersistent = n["persist"];
if (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; }
else { this.reqTimeout = 120000; }
if (n.paytoqs === true || n.paytoqs === "query") { paytoqs = true; }
else if (n.paytoqs === "body") { paytobody = true; }
var prox, noprox;
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",
"headers": "Headers",
"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",
"binaryBuffer": "binary buffer",
"jsonObject": "parsed JSON object",