Skip to content

Commit fd71562

Browse files
committed
try parsing payload a new way
1 parent fdbd84d commit fd71562

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

.vscode/launch.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4-
{
5-
"type": "node",
6-
"request": "attach",
7-
"name": "Attach to 10.0.0.201 (OpenFlow)",
8-
"address": "10.0.0.201",
9-
"port": 5858,
10-
"localRoot": "${workspaceFolder}/dist",
11-
"remoteRoot": "/data"
12-
},
134
{
145
"type": "node",
156
"request": "attach",

OpenFlowNodeRED/src/nodered/nodes/workflow_nodes.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,18 @@ export class workflow_in_node {
163163
if (ack !== null && ack !== undefined) ack();
164164
return;
165165
}
166-
if (res[0].payload === null || res[0].payload === undefined) {
167-
res[0].payload = data;
168-
data = res[0];
166+
var orgmsg = res[0];
167+
if (orgmsg.payload === null || orgmsg.payload === undefined) {
168+
orgmsg.payload = data;
169+
data = orgmsg;
169170
} else {
170-
res[0].payload = Object.assign(res[0].payload, data);
171-
data = res[0];
171+
if (typeof orgmsg.payload === "object") {
172+
orgmsg.payload = Object.assign(orgmsg.payload, data);
173+
} else {
174+
orgmsg.payload = { message: orgmsg.payload };
175+
orgmsg.payload = Object.assign(orgmsg.payload, data);
176+
}
177+
data = orgmsg;
172178
}
173179
data.jwt = jwt;
174180
// console.log(data.payload);

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.516
1+
0.0.517

0 commit comments

Comments
 (0)