Bugfix: stringify payload before sending to be able to send numbers etc

This commit is contained in:
Olivier Verhaegen
2023-04-17 13:42:21 +02:00
committed by GitHub
parent c398b3a60a
commit d5a097b1a3

View File

@@ -410,6 +410,11 @@ module.exports = function(RED) {
node.on("input", function(msg, send, done) {
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 || {});
done();
}