diff --git a/sdk-core/src/core/query/core-query.ts b/sdk-core/src/core/query/core-query.ts index 761d4d3..b9d56f7 100644 --- a/sdk-core/src/core/query/core-query.ts +++ b/sdk-core/src/core/query/core-query.ts @@ -161,7 +161,11 @@ export abstract class CoreQuery, U extends CoreObjectAtt let url: string = ''; queries.forEach((query: Query) => { - url += `${query.toString()}&`; + const queryString: string = query.toString(); + + if (queryString !== '') { + url += `${queryString}&`; + } }); // remove the last & keyword @@ -171,6 +175,17 @@ export abstract class CoreQuery, U extends CoreObjectAtt public static async fetch>(service: Service, instance: T, encodedURL: string, type: QueryFetchType, abort?: AbortSignal): Promise> { const results: Array = new Array(); + if (!fetch) { + CoreError.init({ + error: { + title: 'Runtime Error', + text: `native fetch api not available, uprade your ${Util.isNode() ? 'NodeJS' : 'Browser'} environment` + } + }).handle(service); + + return results; + } + const headers: HeadersInit = { 'Content-Type': 'application/json', 'Accept': 'application/json'