Repository navigation
feat: Expose enableCompression on ObjcLDConfig - #543
Open
abelonogov-ld wants to merge 3 commits into
Open
abelonogov-ld wants to merge 3 commits into
abelonogov-ld wants to merge 3 commits into
Conversation
LDConfig.enableCompression now defaults to true, so analytics and diagnostic event payloads are sent gzip-encoded using the SDK's existing compression. Applications sending events through a relay proxy that does not accept gzip-encoded payloads can set it to false. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9d04f1b. Configure here.
Objective-C applications sending events through a relay proxy that does not accept gzip-encoded payloads need a way to opt out of the new default. Co-authored-by: Cursor <cursoragent@cursor.com>
2 of 3 tasks
Older relay proxy versions do not accept gzip-encoded event payloads, so enableCompression stays opt-in. The Objective-C setting and the tests remain, with the default reversed. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Requirements
Related issues
Follows #399, which added
LDConfig.enableCompressionas an opt-in.Describe the solution you've provided
enableCompressionstays opt-in (defaultfalse), because older relay proxy versions do not accept gzip-encoded event payloads. This PR makes the setting reachable from Objective-C and covers both settings in tests; there is no behavior change for existing applications.ObjcLDConfig.enableCompression: exposes the Swift setting to Objective-C (defaultNO).DarklyServiceSpec: a default request carries noContent-Encodingand sends the payload as is; with compression enabled it carriesContent-Encoding: gzipand the body gunzips to the payload.LDConfigSpec: a default config has compression disabled, and the Objective-C property reads and writes the underlying config.Describe alternatives you've considered
Turning compression on by default. The client SDK cannot tell whether its events URL is a relay proxy, or which version, so a default of
truewould break applications sending events through an older relay proxy on upgrade.Additional context
Verified:
LDConfigSpecandDarklyServiceSpecon macOS, 64 tests, 0 failures.Note
Overview
Exposes the existing
enableCompressionsetting onObjcLDConfigso Objective-C apps can control whether analytics/diagnostic event bodies are gzip-encoded, with docs noting the default is off for older relay-proxy compatibility and that direct-to-LaunchDarkly customers should enable it.Adds tests that lock in current behavior:
LDConfig/ObjcLDConfigdefault to compression disabled, the Obj-C getter/setter updates the wrapped Swift config, andDarklyService.publishEventDatasends an uncompressed body with noContent-Encodingunless compression is turned on (thengzipand a gunzippable body).Reviewed by Cursor Bugbot for commit 1f1c8fb. Bugbot is set up for automated code reviews on this repo. Configure here.