diff --git a/src/common/client/api-client.ts b/src/common/client/api-client.ts index 124c908..3102731 100644 --- a/src/common/client/api-client.ts +++ b/src/common/client/api-client.ts @@ -5,6 +5,7 @@ export interface ApiClient { export interface BugSplatResponse { status: number; + body: ReadableStream | null; json: () => Promise; text: () => Promise; } diff --git a/src/common/client/bugsplat-api-client/bugsplat-api-client.ts b/src/common/client/bugsplat-api-client/bugsplat-api-client.ts index 830306a..14c4c82 100644 --- a/src/common/client/bugsplat-api-client/bugsplat-api-client.ts +++ b/src/common/client/bugsplat-api-client/bugsplat-api-client.ts @@ -51,9 +51,11 @@ export class BugSplatApiClient implements ApiClient { const url = new URL(route, this._host); const response = await this._fetch(url.href, init); const status = response.status; + const body = response.body; return { status, + body, json: async () => response.clone().json(), text: async () => response.clone().text() }; diff --git a/src/common/client/oauth-client-credentials-api-client/oauth-client-credentials-api-client.ts b/src/common/client/oauth-client-credentials-api-client/oauth-client-credentials-api-client.ts index eb7870a..9b1b07e 100644 --- a/src/common/client/oauth-client-credentials-api-client/oauth-client-credentials-api-client.ts +++ b/src/common/client/oauth-client-credentials-api-client/oauth-client-credentials-api-client.ts @@ -72,6 +72,7 @@ export class OAuthClientCredentialsClient implements ApiClient { const response = await this._fetch(url.href, init); const status = response.status; + const body = response.body; if (status === 401) { throw new Error('Could not authenticate, check credentials and try again'); @@ -79,6 +80,7 @@ export class OAuthClientCredentialsClient implements ApiClient { return { status, + body, json: async () => response.clone().json(), text: async () => response.clone().text() }; diff --git a/src/common/data/table-data/table-data-client/table-data-client.ts b/src/common/data/table-data/table-data-client/table-data-client.ts index f01635a..87c93e5 100644 --- a/src/common/data/table-data/table-data-client/table-data-client.ts +++ b/src/common/data/table-data/table-data-client/table-data-client.ts @@ -56,11 +56,13 @@ export class TableDataClient { const pageData = responseData ? responseData[0]?.PageData : {}; const status = response.status; + const body = response.body; const payload = { rows, pageData } as TableDataResponse; const json = async () => payload; const text = async () => JSON.stringify(payload); return { status, + body, json, text }; diff --git a/src/summary/summary-table-data/summary-table-data-client.ts b/src/summary/summary-table-data/summary-table-data-client.ts index 5ebf5f9..1af89fb 100644 --- a/src/summary/summary-table-data/summary-table-data-client.ts +++ b/src/summary/summary-table-data/summary-table-data-client.ts @@ -38,12 +38,14 @@ export class SummaryTableDataClient { const rows = responseData ? responseData[0]?.Rows : []; const pageData = responseData ? responseData[0]?.PageData : {}; + const body = response.body; const status = response.status; const payload = { rows, pageData }; const json = async () => payload; const text = async () => JSON.stringify(payload); return { status, + body, json, text };