http request node: warn user if msg.requestTimeout == 0

This commit is contained in:
Nathanaël Lécaudé
2019-04-02 15:00:25 -04:00
parent 7b15ba31ea
commit c1e3b0d971
2 changed files with 25 additions and 2 deletions

View File

@@ -94,10 +94,10 @@ module.exports = function(RED) {
opts.maxRedirects = 21;
opts.jar = request.jar();
opts.proxy = null;
if (msg.requestTimeout) {
if (msg.requestTimeout !== undefined) {
if (isNaN(msg.requestTimeout)) {
node.warn(RED._("httpin.errors.timeout-isnan"));
} else if (msg.requestTimeout < 0) {
} else if (msg.requestTimeout < 1) {
node.warn(RED._("httpin.errors.timeout-isnegative"));
} else {
opts.timeout = msg.requestTimeout;