mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
http request node add transport validity check and warn.
This commit is contained in:
parent
5b5f9aa01d
commit
524021f0fa
@ -103,7 +103,7 @@
|
|||||||
name: {value:""},
|
name: {value:""},
|
||||||
method:{value:"GET"},
|
method:{value:"GET"},
|
||||||
ret: {value:"txt"},
|
ret: {value:"txt"},
|
||||||
url:{value:""},
|
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}
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
@ -112,6 +112,9 @@
|
|||||||
},
|
},
|
||||||
inputs:1,
|
inputs:1,
|
||||||
outputs:1,
|
outputs:1,
|
||||||
|
outputLabels: function(i) {
|
||||||
|
return ({txt:"UTF8 string", bin:"binary buffer", obj:"parsed JSON object"}[this.ret]);
|
||||||
|
},
|
||||||
icon: "white-globe.png",
|
icon: "white-globe.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name||this._("httpin.httpreq");
|
return this.name||this._("httpin.httpreq");
|
||||||
|
@ -53,9 +53,13 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
if (!url) {
|
if (!url) {
|
||||||
node.error(RED._("httpin.errors.no-url"),msg);
|
node.error(RED._("httpin.errors.no-url"),msg);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// url must start http:// or https:// so assume http:// if not set
|
// url must start http:// or https:// so assume http:// if not set
|
||||||
|
if (url.indexOf("://") !== -1 && url.indexOf("http") !== 0) {
|
||||||
|
node.warn(RED._("httpin.errors.invalid-transport"));
|
||||||
|
node.status({fill:"red",shape:"ring",text:"httpin.errors.invalid-transport"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!((url.indexOf("http://") === 0) || (url.indexOf("https://") === 0))) {
|
if (!((url.indexOf("http://") === 0) || (url.indexOf("https://") === 0))) {
|
||||||
if (tlsNode) {
|
if (tlsNode) {
|
||||||
url = "https://"+url;
|
url = "https://"+url;
|
||||||
|
@ -355,7 +355,8 @@
|
|||||||
"no-response": "No response object",
|
"no-response": "No response object",
|
||||||
"json-error": "JSON parse error",
|
"json-error": "JSON parse error",
|
||||||
"no-url": "No url specified",
|
"no-url": "No url specified",
|
||||||
"deprecated-call":"Deprecated call to __method__"
|
"deprecated-call":"Deprecated call to __method__",
|
||||||
|
"invalid-transport":"non-http transport requested"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"requesting": "requesting"
|
"requesting": "requesting"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user