1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

duplicate http get or post params into msg.payload to make life easier for debug etc. other properties remain as-is

This commit is contained in:
Dave C-J 2013-11-14 13:25:12 +00:00
parent 510fab7b8f
commit 11523a6ced

View File

@ -30,7 +30,9 @@ function HTTPIn(n) {
var node = this; var node = this;
this.callback = function(req,res) { this.callback = function(req,res) {
node.send({req:req,res:res}); if (node.method == "post") { node.send({req:req,res:res,payload:req.body}); }
else if (node.method == "get") { node.send({req:req,res:res,payload:req.query}); }
else node.send({req:req,res:res});
} }
if (this.method == "get") { if (this.method == "get") {
RED.app.get(this.url,this.callback); RED.app.get(this.url,this.callback);