Skip to content

Commit

Permalink
fix(api): Check for the type property
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Jan 28, 2023
1 parent 4e51506 commit e117475
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nodes/api/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Api extends BaseNode {
);
let data;

if (parsedMessage.data.value.length !== 0) {
if (parsedMessage.data.value && parsedMessage.data.value.length > 0) {
try {
if (parsedMessage.dataType.value === 'jsonata') {
data = this.evaluateJSONata(parsedMessage.data.value, {
Expand Down Expand Up @@ -159,7 +159,7 @@ class Api extends BaseNode {
parsedMessage.responseType.value
);
} else {
if (!data.type) {
if (!data || !data.type) {
done(
`A WebSocket request requires a 'type' property in the data object.`
);
Expand Down

0 comments on commit e117475

Please sign in to comment.