mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure statusCode is a number
Fixes #3893 Used parseInt instead of the suggested fix so that we don't end up with statusCode = 200.5
This commit is contained in:
parent
f060309002
commit
4115c13a65
@ -282,7 +282,7 @@ module.exports = function(RED) {
|
||||
RED.nodes.createNode(this,n);
|
||||
var node = this;
|
||||
this.headers = n.headers||{};
|
||||
this.statusCode = n.statusCode;
|
||||
this.statusCode = parseInt(n.statusCode);
|
||||
this.on("input",function(msg,_send,done) {
|
||||
if (msg.res) {
|
||||
var headers = RED.util.cloneMessage(node.headers);
|
||||
@ -323,7 +323,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
}
|
||||
var statusCode = node.statusCode || msg.statusCode || 200;
|
||||
var statusCode = node.statusCode || parseInt(msg.statusCode) || 200;
|
||||
if (typeof msg.payload == "object" && !Buffer.isBuffer(msg.payload)) {
|
||||
msg.res._res.status(statusCode).jsonp(msg.payload);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user