Fix overriding method in HTTP Req node

This commit is contained in:
Nick O'Leary 2014-02-17 22:16:42 +00:00
parent b7e3e2d739
commit 09f162d933
1 changed files with 3 additions and 3 deletions

View File

@ -106,14 +106,14 @@ RED.nodes.registerType("http response",HTTPOut);
function HTTPRequest(n) { function HTTPRequest(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
var nodeUrl = n.url; var nodeUrl = n.url;
var method = n.method || "GET"; var nodeMethod = n.method || "GET";
var node = this; var node = this;
this.on("input",function(msg) { this.on("input",function(msg) {
var url = msg.url||nodeUrl; var url = msg.url||nodeUrl;
var method = (msg.method||nodeMethod).toUpperCase();
var opts = urllib.parse(url); var opts = urllib.parse(url);
opts.method = (msg.method||method).toUpperCase(); opts.method = method;
if (msg.headers) { if (msg.headers) {
opts.headers = msg.headers; opts.headers = msg.headers;
} }