mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Bugfix: stringify payload before sending to be able to send numbers etc
This commit is contained in:
parent
c398b3a60a
commit
d5a097b1a3
@ -410,6 +410,11 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
node.on("input", function(msg, send, done) {
|
node.on("input", function(msg, send, done) {
|
||||||
if (node.topic && msg.payload) {
|
if (node.topic && msg.payload) {
|
||||||
|
try {
|
||||||
|
msg.payload = JSON.stringify(msg.payload);
|
||||||
|
} catch {
|
||||||
|
msg.payload = `${msg.payload}`;
|
||||||
|
}
|
||||||
node.serverConnection.publish(node.topic, msg.payload, msg.headers || {});
|
node.serverConnection.publish(node.topic, msg.payload, msg.headers || {});
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user