Skip to content

Commit

Permalink
Merge pull request #49 from qorelanguage/bugfix/empty-response-fix
Browse files Browse the repository at this point in the history
Bump version to 0.4.9, enhance error handling in QorusRequest, and update IQorusAllowedValue to allow optional fields
  • Loading branch information
Foxhoundn authored Dec 10, 2024
2 parents 718e310 + 9d36d59 commit 41217e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qoretechnologies/ts-toolkit",
"version": "0.4.8",
"version": "0.4.9",
"description": "Utility library to interact with Qorus Integration Engine & Qore Language",
"keywords": [
"qoretechnologies",
Expand Down
9 changes: 8 additions & 1 deletion src/QorusRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ export class QorusRequest {
throw new ErrorQorusRequest(text);
}

const json = await promise.json();
let json: any;

// We need to turn the promise to json but if the response is empty we need to return an empty object
try {
json = await promise.json();
} catch (error) {
json = {};
}

return { data: json };
}
Expand Down
5 changes: 3 additions & 2 deletions src/types/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export interface IQorusFormFieldMessage<Intent> {

export interface IQorusAllowedValue {
display_name: string;
short_desc: string;
desc: string;
short_desc?: string;
desc?: string;
value: unknown;
}

Expand All @@ -45,6 +45,7 @@ export interface IQorusFormFieldSchema<Intent, FocusRules> {
sensitive?: boolean;

allowed_values?: IQorusAllowedValue[];
allowed_values_creatable?: boolean;
allowed_schemes?: IQorusAllowedValue[];
arg_schema?: IQorusFormSchema<Intent, FocusRules>;

Expand Down

0 comments on commit 41217e2

Please sign in to comment.