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

Add missing HTTP methods

This commit is contained in:
Steve-Mcl 2022-03-07 15:55:48 +00:00
parent 0533c08438
commit 381814d9a7
2 changed files with 17 additions and 1 deletions

View File

@ -23,6 +23,10 @@
<option value="put">PUT</option>
<option value="delete">DELETE</option>
<option value="patch">PATCH</option>
<option value="head">HEAD</option>
<option value="options">OPTIONS</option>
<option value="trace">TRACE</option>
<option value="connect">CONNECT</option>
</select>
</div>
<div class="form-row form-row-http-in-upload hide">

View File

@ -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() {