Skip to content

Commit

Permalink
fix: deprecate old api/crash/data endpoint
Browse files Browse the repository at this point in the history
BREAKING CHANGE: new api/crash does not return addtionalFiles
  • Loading branch information
bobbyg603 committed Aug 25, 2024
1 parent 3a0617b commit ba96fd3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
7 changes: 7 additions & 0 deletions spec/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ if (!clientSecret) {
throw new Error('Please set BUGSPLAT_CLIENT_SECRET env variable');
}

if (host.includes('octomore')) {
// This allows us to use self-signed certificates, or out-of-date certs in our tests.
// Without this, Node fetch rejects the requests to octomore.bugsplat.com when we map
// it to a local IP address using /etc/hosts.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

Check failure

Code scanning / CodeQL

Disabling certificate validation High test

Disabling certificate validation is strongly discouraged.
}

export const config = {
host,
email,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('BugSplatApiClient', () => {
});

describe('fetch', () => {
const route = '/api/crash/data';
const route = '/api/crash/details';
let body;
let headers;
let init;
Expand Down
4 changes: 2 additions & 2 deletions src/crash/crash-api-client/crash-api-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('CrashApiClient', () => {
});

it('should call fetch with correct route', () => {
expect(fakeBugSplatApiClient.fetch).toHaveBeenCalledWith('/api/crash/data', jasmine.anything());
expect(fakeBugSplatApiClient.fetch).toHaveBeenCalledWith('/api/crash/details', jasmine.anything());
});

it('should call fetch with formData containing database and id', () => {
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('CrashApiClient', () => {
});

it('should call fetch with correct route', () => {
expect(fakeBugSplatApiClient.fetch).toHaveBeenCalledWith('/api/crash/reprocess', jasmine.anything());
expect(fakeBugSplatApiClient.fetch).toHaveBeenCalledWith('/api/crash/details/reprocess', jasmine.anything());
});

it('should call form data append with processor if provided', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/crash/crash-api-client/crash-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class CrashApiClient {
duplex: 'half'
} as RequestInit;

const response = await this._client.fetch<GetCrashByIdResponse>('/api/crash/data', init);
const response = await this._client.fetch<GetCrashByIdResponse>('/api/crash/details', init);
const json = await response.json();

if (response.status !== 200) {
Expand Down Expand Up @@ -66,7 +66,7 @@ export class CrashApiClient {
duplex: 'half'
} as RequestInit;

const response = await this._client.fetch<ReprocessCrashResponse>('/api/crash/reprocess', init);
const response = await this._client.fetch<ReprocessCrashResponse>('/api/crash/details/reprocess', init);
const json = await response.json();

if (response.status !== 202) {
Expand Down
2 changes: 0 additions & 2 deletions src/crash/crash-details/crash-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export enum DefectTrackerType {
export interface CrashDetails {
processed: ProcessingStatus;

additionalFiles: Array<string>;
appKey: string;
appName: string;
appVersion: string;
Expand Down Expand Up @@ -91,7 +90,6 @@ export function createCrashDetails(options: CrashDetailsRawResponse): CrashDetai
const user = defaultToEmptyString(options.user, 'options.user');

ac.assertType(options.thread, ThreadCollection, 'options.thread');
ac.assertType(options.additionalFiles, Array, 'options.additionalFiles');
ac.assertType(options.events, Array, 'options.events');

const events = createEvents(options.events as EventResponseObject[]);
Expand Down

0 comments on commit ba96fd3

Please sign in to comment.