mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
http request: add msg.requestTimeout parameter
This commit is contained in:
@@ -97,6 +97,8 @@
|
||||
self signed certificates.</dd>
|
||||
<dt class="optional">followRedirects</dt>
|
||||
<dd>If set to <code>false</code> prevent following Redirect (HTTP 301).<code>true</code> by default</dd>
|
||||
<dt class="optional">requestTimeout</dt>
|
||||
<dd>If set to a positive number, will override the globally set <code>httpRequestTimeout</code> parameter.</dd>
|
||||
</dl>
|
||||
<h3>Outputs</h3>
|
||||
<dl class="message-properties">
|
||||
|
@@ -92,6 +92,15 @@ module.exports = function(RED) {
|
||||
opts.maxRedirects = 21;
|
||||
opts.jar = request.jar();
|
||||
opts.proxy = null;
|
||||
if (msg.requestTimeout) {
|
||||
if (isNaN(msg.requestTimeout)) {
|
||||
node.warn(RED._("httpin.errors.timeout-isnan"))
|
||||
} else if (msg.requestTimeout < 0) {
|
||||
node.warn(RED._("httpin.errors.timeout-isnegative"))
|
||||
} else {
|
||||
opts.timeout = msg.requestTimeout;
|
||||
}
|
||||
}
|
||||
var ctSet = "Content-Type"; // set default camel case
|
||||
var clSet = "Content-Length";
|
||||
if (msg.headers) {
|
||||
|
@@ -410,7 +410,9 @@
|
||||
"json-error": "JSON parse error",
|
||||
"no-url": "No url specified",
|
||||
"deprecated-call":"Deprecated call to __method__",
|
||||
"invalid-transport":"non-http transport requested"
|
||||
"invalid-transport":"non-http transport requested",
|
||||
"timeout-isnan": "Timeout value is not a valid number, ignoring",
|
||||
"timeout-isnegative": "Timeout value is negative, ignoring"
|
||||
},
|
||||
"status": {
|
||||
"requesting": "requesting"
|
||||
|
Reference in New Issue
Block a user