Allow http to accept delete properly, and put, options etc.

This commit is contained in:
dceejay 2015-05-07 16:45:44 +01:00
parent 07fd5a5f5f
commit cf25b2866e
1 changed files with 5 additions and 5 deletions

View File

@ -60,7 +60,7 @@ module.exports = function(RED) {
}; };
this.callback = function(req,res) { this.callback = function(req,res) {
if (node.method == "post") { if (node.method.match(/(^post$|^delete$|^put$|^options$)/)) {
node.send({req:req,res:res,payload:req.body}); node.send({req:req,res:res,payload:req.body});
} else if (node.method == "get") { } else if (node.method == "get") {
node.send({req:req,res:res,payload:req.query}); node.send({req:req,res:res,payload:req.query});
@ -103,7 +103,7 @@ module.exports = function(RED) {
} else if (this.method == "put") { } else if (this.method == "put") {
RED.httpNode.put(this.url,corsHandler,metricsHandler,jsonParser,urlencParser,rawBodyParser,this.callback,this.errorHandler); RED.httpNode.put(this.url,corsHandler,metricsHandler,jsonParser,urlencParser,rawBodyParser,this.callback,this.errorHandler);
} else if (this.method == "delete") { } else if (this.method == "delete") {
RED.httpNode.delete(this.url,corsHandler,metricsHandler,this.callback,this.errorHandler); RED.httpNode.delete(this.url,corsHandler,metricsHandler,jsonParser,urlencParser,rawBodyParser,this.callback,this.errorHandler);
} }
this.on("close",function() { this.on("close",function() {