Repository navigation
fix: send analytics with the client fetch, agent and custom headers - #334
pcbeingused33 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
The follow-up normalizes all three forms of This comment was drafted with Claude Code. |
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval skipped because this PR is from an external contributor.
Re-trigger cubic
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
With
enableAnalytics: true, thefetch,agentandcustomHeadersclient options were not applied to the analytics requests.FlagsmithConfigdocuments them as used for HTTP requests, and flag and event requests already use them, but theAnalyticsProcessorwas constructed without any of the three. Behind a proxyagent, or a gateway that requires a custom header, flags work while analytics posts fail.The client now passes all three to
AnalyticsProcessor, which uses them inflush().customHeadersis typed asHeadersInit, so analytics accepts a record, aHeadersinstance or a list of name/value tuples. As in the event processor, the SDK's ownX-Environment-Key,Content-TypeandUser-Agenttake precedence over custom headers with the same name, regardless of casing.#329 also changes
flush(); whichever lands second will need a small rebase.How did you test this code?
Added a parameterized test in
tests/sdk/analytics.test.tsthat builds a client with a customfetch,agentand headers (as a record, aHeadersinstance and tuples, including lowercasex-environment-key,content-typeanduser-agent), evaluates a flag and flushes analytics. It fails before the change and passes after it. The full unit suite (508 tests) and the CommonJS and ESM builds pass; the engine e2e suite was not run because its test data submodule was not checked out.This change was prepared with AI assistance.