-
Notifications
You must be signed in to change notification settings - Fork 56
Add gzip compression using Compression Streams API #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added GZIP compression support for JSON capture mode using the Compression Streams API, improving data transmission efficiency for large payloads.
- Added
gzip.ts
with feature detection and compression functionality usingCompressionStream
- Modified batch endpoint URL to include
?compression=gzip-js
parameter when GZIP is enabled - Updated
PostHogFetchOptions
type to supportBlob
body for compressed data - Added runtime check via
isGzipSupported()
to gracefully handle environments without compression support - Set Content-Type header to
text/plain
for GZIP compressed requests
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@raikasdev the remote config/decide API will return |
@raikasdev once you fix tests (maybe you have to forcefully disable compression in tests)/lint I can test it out. |
Fixed tests requiring JSON bodies and added few tests for gzip compress using Node's builtin gzip (via |
posthog-js-lite/posthog-core/src/index.ts Line 854 in df41c7b
on this line we should also check for disableCompression and supportedCompression
|
Test should be fixed, weird that it worked locally without the import 😄. I'll look at the comments later today |
@marandaneto If |
this will be addressed later on with another issue/PR #483 |
@raikasdev thanks |
Weird, locally prettier doesn't show anything 🤔 |
probably versioning, lets see if this helps |
Problem
Adds GZIP compression support for
json
capturemodeCloses #254
Changes
Simple wrapper around CompressionStream and a function to check if the class is available
Release info Sub-libraries affected
Bump level
Libraries affected
Changelog notes