mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	| @@ -244,19 +244,25 @@ module.exports = function(RED) { | |||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                     // Convert the payload to the required return type |                     // Check that msg.payload is an array - if the req error | ||||||
|                     msg.payload = Buffer.concat(msg.payload); // bin |                     // handler has been called, it will have been set to a string | ||||||
|                     if (node.ret !== "bin") { |                     // and the error already handled - so no further action should | ||||||
|                         msg.payload = msg.payload.toString('utf8'); // txt |                     // be taken. #1344 | ||||||
|  |                     if (Array.isArray(msg.payload)) { | ||||||
|  |                         // Convert the payload to the required return type | ||||||
|  |                         msg.payload = Buffer.concat(msg.payload); // bin | ||||||
|  |                         if (node.ret !== "bin") { | ||||||
|  |                             msg.payload = msg.payload.toString('utf8'); // txt | ||||||
|  |  | ||||||
|                         if (node.ret === "obj") { |                             if (node.ret === "obj") { | ||||||
|                             try { msg.payload = JSON.parse(msg.payload); } // obj |                                 try { msg.payload = JSON.parse(msg.payload); } // obj | ||||||
|                             catch(e) { node.warn(RED._("httpin.errors.json-error")); } |                                 catch(e) { node.warn(RED._("httpin.errors.json-error")); } | ||||||
|  |                             } | ||||||
|                         } |                         } | ||||||
|                     } |  | ||||||
|  |  | ||||||
|                     node.send(msg); |                         node.send(msg); | ||||||
|                     node.status({}); |                         node.status({}); | ||||||
|  |                     } | ||||||
|                 }); |                 }); | ||||||
|             }); |             }); | ||||||
|             req.setTimeout(node.reqTimeout, function() { |             req.setTimeout(node.reqTimeout, function() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user