From 381814d9a7085064d3a0e765afd940a1f12b12ec Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Mon, 7 Mar 2022 15:55:48 +0000 Subject: [PATCH] Add missing HTTP methods --- .../@node-red/nodes/core/network/21-httpin.html | 4 ++++ .../@node-red/nodes/core/network/21-httpin.js | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httpin.html b/packages/node_modules/@node-red/nodes/core/network/21-httpin.html index 450bd32cc..cb652f303 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httpin.html +++ b/packages/node_modules/@node-red/nodes/core/network/21-httpin.html @@ -23,6 +23,10 @@ + + + +
diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httpin.js b/packages/node_modules/@node-red/nodes/core/network/21-httpin.js index b458a459c..50bcf6eed 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httpin.js +++ b/packages/node_modules/@node-red/nodes/core/network/21-httpin.js @@ -171,7 +171,9 @@ module.exports = function(RED) { if (RED.settings.httpNodeCors) { corsHandler = cors(RED.settings.httpNodeCors); - RED.httpNode.options("*",corsHandler); + RED.httpNode.options("*", function(req,res,next) { + corsHandler(req,res,next); + }); } function HTTPIn(n) { @@ -261,6 +263,16 @@ module.exports = function(RED) { RED.httpNode.patch(this.url,cookieParser(),httpMiddleware,corsHandler,metricsHandler,jsonParser,urlencParser,rawBodyParser,this.callback,this.errorHandler); } else if (this.method == "delete") { RED.httpNode.delete(this.url,cookieParser(),httpMiddleware,corsHandler,metricsHandler,jsonParser,urlencParser,rawBodyParser,this.callback,this.errorHandler); + } else if (this.method == "head") { + RED.httpNode.head(this.url,cookieParser(),httpMiddleware,corsHandler,metricsHandler,jsonParser,urlencParser,this.callback,this.errorHandler); + } else if (this.method == "options") { + RED.httpNode.options(this.url,cookieParser(),httpMiddleware,corsHandler,metricsHandler,function name(req,res,next) { + this.callback(req,res,next) + },this.errorHandler); + } else if (this.method == "trace") { + RED.httpNode.trace(this.url,cookieParser(),httpMiddleware,corsHandler,metricsHandler,this.callback,this.errorHandler); + } else if (this.method == "connect") { + RED.httpNode.connect(this.url,cookieParser(),httpMiddleware,corsHandler,metricsHandler,this.callback,this.errorHandler); } this.on("close",function() {