From ba96fd3edd1cc4d9c1117944a5728195f2cd2aa3 Mon Sep 17 00:00:00 2001 From: Bobby Galli Date: Sun, 25 Aug 2024 19:41:51 -0400 Subject: [PATCH] fix: deprecate old api/crash/data endpoint BREAKING CHANGE: new api/crash does not return addtionalFiles --- spec/config.ts | 7 +++++++ .../client/bugsplat-api-client/bugsplat-api-client.spec.ts | 2 +- src/crash/crash-api-client/crash-api-client.spec.ts | 4 ++-- src/crash/crash-api-client/crash-api-client.ts | 4 ++-- src/crash/crash-details/crash-details.ts | 2 -- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/spec/config.ts b/spec/config.ts index adbff9c..c16d2dc 100644 --- a/spec/config.ts +++ b/spec/config.ts @@ -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'; +} + export const config = { host, email, diff --git a/src/common/client/bugsplat-api-client/bugsplat-api-client.spec.ts b/src/common/client/bugsplat-api-client/bugsplat-api-client.spec.ts index 7bb74f8..42314b0 100644 --- a/src/common/client/bugsplat-api-client/bugsplat-api-client.spec.ts +++ b/src/common/client/bugsplat-api-client/bugsplat-api-client.spec.ts @@ -31,7 +31,7 @@ describe('BugSplatApiClient', () => { }); describe('fetch', () => { - const route = '/api/crash/data'; + const route = '/api/crash/details'; let body; let headers; let init; diff --git a/src/crash/crash-api-client/crash-api-client.spec.ts b/src/crash/crash-api-client/crash-api-client.spec.ts index dd42b64..2704e7a 100644 --- a/src/crash/crash-api-client/crash-api-client.spec.ts +++ b/src/crash/crash-api-client/crash-api-client.spec.ts @@ -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', () => { @@ -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 () => { diff --git a/src/crash/crash-api-client/crash-api-client.ts b/src/crash/crash-api-client/crash-api-client.ts index d62bbb8..4c15ce3 100644 --- a/src/crash/crash-api-client/crash-api-client.ts +++ b/src/crash/crash-api-client/crash-api-client.ts @@ -26,7 +26,7 @@ export class CrashApiClient { duplex: 'half' } as RequestInit; - const response = await this._client.fetch('/api/crash/data', init); + const response = await this._client.fetch('/api/crash/details', init); const json = await response.json(); if (response.status !== 200) { @@ -66,7 +66,7 @@ export class CrashApiClient { duplex: 'half' } as RequestInit; - const response = await this._client.fetch('/api/crash/reprocess', init); + const response = await this._client.fetch('/api/crash/details/reprocess', init); const json = await response.json(); if (response.status !== 202) { diff --git a/src/crash/crash-details/crash-details.ts b/src/crash/crash-details/crash-details.ts index dbb5c09..4f803ae 100644 --- a/src/crash/crash-details/crash-details.ts +++ b/src/crash/crash-details/crash-details.ts @@ -26,7 +26,6 @@ export enum DefectTrackerType { export interface CrashDetails { processed: ProcessingStatus; - additionalFiles: Array; appKey: string; appName: string; appVersion: string; @@ -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[]);