Skip to content

Commit

Permalink
Fix: Use the default message when no valid message option is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
gvensan committed Feb 26, 2024
1 parent 709e858 commit 2d5af17
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stm",
"version": "0.0.30",
"version": "0.0.31",
"description": "Solace Try-Me Command Line Tool",
"keywords": [
"solace",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const publish = async (
}

var message:any = options.message as string;
message = (optionsSource.defaultMessage === 'cli') ? getDefaultMessage() : message;
message = (optionsSource.defaultMessage === 'default' || optionsSource.defaultMessage === 'cli') ? getDefaultMessage() : message;

var contentType:any = options.contentType as string;

Expand Down Expand Up @@ -69,7 +69,7 @@ const publish = async (

if (count === 1) {
for (var i=0; i<options.topic.length; i++) {
if (optionsSource.defaultMessage === 'cli') message = getDefaultMessage();
if (optionsSource.defaultMessage === 'default' || optionsSource.defaultMessage === 'cli') message = getDefaultMessage();
publisher.publish(options.topic[i], message, contentType, 0);
}
if (options.waitBeforeExit) {
Expand All @@ -83,7 +83,7 @@ const publish = async (
} else {
for (var iter=count ? count : 1, n=1;iter > 0;iter--, n++) {
for (var i=0; i<options.topic.length; i++) {
if (optionsSource.defaultMessage === 'cli') message = getDefaultMessage();
if (optionsSource.defaultMessage === 'default' || optionsSource.defaultMessage === 'cli') message = getDefaultMessage();
publisher.publish(options.topic[i], message, contentType, n-1);
}
if (interval) await delay(interval)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const reply = async (
});

var message:any = options.message as string;
message = (optionsSource.defaultMessage === 'cli') ? getDefaultMessage() : message;
message = (optionsSource.defaultMessage === 'default' || optionsSource.defaultMessage === 'cli') ? getDefaultMessage() : message;

var contentType:any = options.contentType as string;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const request = async (
});

var message:any = options.message as string;
message = (optionsSource.defaultMessage === 'cli') ? getDefaultMessage() : message;
message = (optionsSource.defaultMessage === 'default' || optionsSource.defaultMessage === 'cli') ? getDefaultMessage() : message;

var contentType:any = options.contentType as string;

Expand Down

0 comments on commit 2d5af17

Please sign in to comment.