Skip to content

Commit

Permalink
Wrap http request object to match http response object
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Jan 11, 2016
1 parent 0786ec4 commit de48c1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nodes/core/io/21-httpin.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = function(RED) {
wrapper[f] = function() {
node.warn(RED._("httpin.errors.deprecated-call",{method:"msg.req."+f}));
var result = req[f].apply(req,arguments);
if (result === res) {
if (result === req) {
return wrapper;
} else {
return result;
Expand Down Expand Up @@ -177,11 +177,11 @@ module.exports = function(RED) {
var msgid = RED.util.generateId();
res._msgid = msgid;
if (node.method.match(/(^post$|^delete$|^put$|^options$)/)) {
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),payload:req.body});
node.send({_msgid:msgid,req:createRequestWrapper(node,req),res:createResponseWrapper(node,res),payload:req.body});
} else if (node.method == "get") {
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),payload:req.query});
node.send({_msgid:msgid,req:createRequestWrapper(node,req),res:createResponseWrapper(node,res),payload:req.query});
} else {
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res)});
node.send({_msgid:msgid,req:createRequestWrapper(node,req),res:createResponseWrapper(node,res)});
}
};

Expand Down

0 comments on commit de48c1b

Please sign in to comment.