From f87ef93ec395dd2ab1ebc394d42b1825469c3be8 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Tue, 17 Dec 2024 14:00:35 +0100 Subject: [PATCH] fix: specify transport in fewer places to let config control (#1614) * fix: specify transport in fewer places to let config control * fix --- src/__tests__/featureflags.test.ts | 2 -- src/__tests__/surveys.test.ts | 2 -- src/posthog-featureflags.ts | 1 - src/posthog-surveys.ts | 1 - src/web-experiments.ts | 1 - 5 files changed, 7 deletions(-) diff --git a/src/__tests__/featureflags.test.ts b/src/__tests__/featureflags.test.ts index 4eb07e9dd..ebf0084f6 100644 --- a/src/__tests__/featureflags.test.ts +++ b/src/__tests__/featureflags.test.ts @@ -475,7 +475,6 @@ describe('featureflags', () => { expect(instance._send_request).toHaveBeenCalledWith({ url: 'https://us.i.posthog.com/api/early_access_features/?token=random fake token', method: 'GET', - transport: 'fetch', callback: expect.any(Function), }) expect(instance._send_request).toHaveBeenCalledTimes(1) @@ -507,7 +506,6 @@ describe('featureflags', () => { url: 'https://us.i.posthog.com/api/early_access_features/?token=random fake token', method: 'GET', callback: expect.any(Function), - transport: 'fetch', }) expect(instance._send_request).toHaveBeenCalledTimes(1) diff --git a/src/__tests__/surveys.test.ts b/src/__tests__/surveys.test.ts index f0e57fec0..1a465f73d 100644 --- a/src/__tests__/surveys.test.ts +++ b/src/__tests__/surveys.test.ts @@ -236,7 +236,6 @@ describe('surveys', () => { expect(instance._send_request).toHaveBeenCalledWith({ url: 'https://us.i.posthog.com/api/surveys/?token=testtoken', method: 'GET', - transport: 'fetch', callback: expect.any(Function), }) expect(instance._send_request).toHaveBeenCalledTimes(1) @@ -281,7 +280,6 @@ describe('surveys', () => { expect(instance._send_request).toHaveBeenCalledWith({ url: 'https://us.i.posthog.com/api/surveys/?token=testtoken', method: 'GET', - transport: 'fetch', callback: expect.any(Function), }) expect(instance._send_request).toHaveBeenCalledTimes(1) diff --git a/src/posthog-featureflags.ts b/src/posthog-featureflags.ts index 910a5c48e..250bde8b1 100644 --- a/src/posthog-featureflags.ts +++ b/src/posthog-featureflags.ts @@ -433,7 +433,6 @@ export class PostHogFeatureFlags { if (!existing_early_access_features || force_reload) { this.instance._send_request({ - transport: 'fetch', url: this.instance.requestRouter.endpointFor( 'api', `/api/early_access_features/?token=${this.instance.config.token}` diff --git a/src/posthog-surveys.ts b/src/posthog-surveys.ts index 3e3b13ffe..3d3c8a488 100644 --- a/src/posthog-surveys.ts +++ b/src/posthog-surveys.ts @@ -118,7 +118,6 @@ export class PostHogSurveys { `/api/surveys/?token=${this.instance.config.token}` ), method: 'GET', - transport: 'fetch', callback: (response) => { if (response.statusCode !== 200 || !response.json) { return callback([]) diff --git a/src/web-experiments.ts b/src/web-experiments.ts index a275b2113..eed4b0ca0 100644 --- a/src/web-experiments.ts +++ b/src/web-experiments.ts @@ -151,7 +151,6 @@ export class WebExperiments { `/api/web_experiments/?token=${this.instance.config.token}` ), method: 'GET', - transport: 'fetch', callback: (response) => { if (response.statusCode !== 200 || !response.json) { return callback([])