Skip to content

Commit 57b079b

Browse files
authored
feat: expose body for file downloads (#110)
1 parent 63afae6 commit 57b079b

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

src/common/client/api-client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export interface ApiClient {
55

66
export interface BugSplatResponse<T = unknown> {
77
status: number;
8+
body: ReadableStream<Uint8Array> | null;
89
json: () => Promise<T>;
910
text: () => Promise<string>;
1011
}

src/common/client/bugsplat-api-client/bugsplat-api-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ export class BugSplatApiClient implements ApiClient {
5151
const url = new URL(route, this._host);
5252
const response = await this._fetch(url.href, init);
5353
const status = response.status;
54+
const body = response.body;
5455

5556
return {
5657
status,
58+
body,
5759
json: async () => response.clone().json(),
5860
text: async () => response.clone().text()
5961
};

src/common/client/oauth-client-credentials-api-client/oauth-client-credentials-api-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ export class OAuthClientCredentialsClient implements ApiClient {
7272

7373
const response = await this._fetch(url.href, init);
7474
const status = response.status;
75+
const body = response.body;
7576

7677
if (status === 401) {
7778
throw new Error('Could not authenticate, check credentials and try again');
7879
}
7980

8081
return {
8182
status,
83+
body,
8284
json: async () => response.clone().json(),
8385
text: async () => response.clone().text()
8486
};

src/common/data/table-data/table-data-client/table-data-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ export class TableDataClient {
5656
const pageData = responseData ? responseData[0]?.PageData : {};
5757

5858
const status = response.status;
59+
const body = response.body;
5960
const payload = { rows, pageData } as TableDataResponse<T, U>;
6061
const json = async () => payload;
6162
const text = async () => JSON.stringify(payload);
6263
return {
6364
status,
65+
body,
6466
json,
6567
text
6668
};

src/summary/summary-table-data/summary-table-data-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ export class SummaryTableDataClient {
3838
const rows = responseData ? responseData[0]?.Rows : [];
3939
const pageData = responseData ? responseData[0]?.PageData : {};
4040

41+
const body = response.body;
4142
const status = response.status;
4243
const payload = { rows, pageData };
4344
const json = async () => payload;
4445
const text = async () => JSON.stringify(payload);
4546
return {
4647
status,
48+
body,
4749
json,
4850
text
4951
};

0 commit comments

Comments
 (0)