From ecf796cfbc4da6c2cc52479c4393daac1e77c29f Mon Sep 17 00:00:00 2001 From: Ben White Date: Fri, 8 Mar 2024 18:17:12 +0100 Subject: [PATCH] Fix compression --- src/posthog-core.ts | 3 ++- src/types.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 3baaaee79..d136efabc 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -573,6 +573,7 @@ export class PostHog { ip: this.config.ip ? 1 : 0, }) options.headers = this.config.request_headers + options.compression = options.compression === 'best-available' ? this.compression : options.compression request({ ...options, @@ -762,7 +763,7 @@ export class PostHog { method: 'POST', url: options?._url ?? this.requestRouter.endpointFor('api', this.analyticsDefaultEndpoint), data, - compression: this.compression, + compression: 'best-available', batchKey: options?._batchKey, } diff --git a/src/types.ts b/src/types.ts index 189a18044..ff5032b41 100644 --- a/src/types.ts +++ b/src/types.ts @@ -215,7 +215,7 @@ export interface RequestOptions { callback?: RequestCallback timeout?: number noRetries?: boolean - compression?: Compression + compression?: Compression | 'best-available' } // Queued request types - the same as a request but with additional queueing information