node-red / node-red/node-red-nodes

Stomp node: error sending payload as XML

Open
#1,068 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
13h 57m
Merged PRs (30d)
3

Description

Which node are you reporting an issue on?

Stomp

What are the steps to reproduce?
  • Format payload as XML
  • Send payload via stomp out node
What happens?
  • Payload as JSON with XML inside
What do you expect to happen?
  • Payload as XML
Please tell us about your environment:
  • Node-RED version: 3
  • node.js version: 18
  • npm version: 10.7
  • Platform/OS: Linux, Windows
  • Browser: Chrome, Edge
When started

commit 0d7f0cb
STOMP refactor in accordance with MQTT (shared connection using confi…

Before

	node.on("input", function(msg) {
            node.client.publish(node.topic || msg.topic, msg.payload, msg.headers);
        });

After

            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();
                }
            });

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the STOMP node input handler shown in the issue and compare the pre-refactor publish call with the current JSON.stringify path. Reproduce the XML payload case, then verify that XML is published as XML while JSON payloads retain their expected behavior; the issue does not name a file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.