From 02fbcfb7b87903273e4e0ce68bd4d42dc23b144c Mon Sep 17 00:00:00 2001 From: Ben White Date: Tue, 17 Dec 2024 10:42:03 +0100 Subject: [PATCH] Fixes --- src/__tests__/featureflags.test.ts | 4 ++-- src/__tests__/surveys.test.ts | 4 ++-- src/posthog-featureflags.ts | 2 +- src/posthog-surveys.ts | 2 +- src/web-experiments.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/__tests__/featureflags.test.ts b/src/__tests__/featureflags.test.ts index a54ada8fd..4eb07e9dd 100644 --- a/src/__tests__/featureflags.test.ts +++ b/src/__tests__/featureflags.test.ts @@ -475,7 +475,7 @@ describe('featureflags', () => { expect(instance._send_request).toHaveBeenCalledWith({ url: 'https://us.i.posthog.com/api/early_access_features/?token=random fake token', method: 'GET', - transport: 'XHR', + transport: 'fetch', callback: expect.any(Function), }) expect(instance._send_request).toHaveBeenCalledTimes(1) @@ -507,7 +507,7 @@ describe('featureflags', () => { url: 'https://us.i.posthog.com/api/early_access_features/?token=random fake token', method: 'GET', callback: expect.any(Function), - transport: 'XHR', + transport: 'fetch', }) expect(instance._send_request).toHaveBeenCalledTimes(1) diff --git a/src/__tests__/surveys.test.ts b/src/__tests__/surveys.test.ts index 6a4fa6916..f0e57fec0 100644 --- a/src/__tests__/surveys.test.ts +++ b/src/__tests__/surveys.test.ts @@ -236,7 +236,7 @@ describe('surveys', () => { expect(instance._send_request).toHaveBeenCalledWith({ url: 'https://us.i.posthog.com/api/surveys/?token=testtoken', method: 'GET', - transport: 'XHR', + transport: 'fetch', callback: expect.any(Function), }) expect(instance._send_request).toHaveBeenCalledTimes(1) @@ -281,7 +281,7 @@ describe('surveys', () => { expect(instance._send_request).toHaveBeenCalledWith({ url: 'https://us.i.posthog.com/api/surveys/?token=testtoken', method: 'GET', - transport: 'XHR', + 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 e8d2e9c3e..910a5c48e 100644 --- a/src/posthog-featureflags.ts +++ b/src/posthog-featureflags.ts @@ -433,7 +433,7 @@ export class PostHogFeatureFlags { if (!existing_early_access_features || force_reload) { this.instance._send_request({ - transport: 'XHR', + 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 f33fe4f4a..3e3b13ffe 100644 --- a/src/posthog-surveys.ts +++ b/src/posthog-surveys.ts @@ -118,7 +118,7 @@ export class PostHogSurveys { `/api/surveys/?token=${this.instance.config.token}` ), method: 'GET', - transport: 'XHR', + 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 74bbc904b..a275b2113 100644 --- a/src/web-experiments.ts +++ b/src/web-experiments.ts @@ -151,7 +151,7 @@ export class WebExperiments { `/api/web_experiments/?token=${this.instance.config.token}` ), method: 'GET', - transport: 'XHR', + transport: 'fetch', callback: (response) => { if (response.statusCode !== 200 || !response.json) { return callback([])