feat(firestore): add Settings.headers to attach custom request headers - #307
feat(firestore): add Settings.headers to attach custom request headers#307demolaf wants to merge 10 commits into
Conversation
… SHA" This reverts commit 005b4a7.
There was a problem hiding this comment.
Code Review
This pull request introduces a new Settings.headers configuration option to allow users to attach custom HTTP headers to outgoing Firestore requests. This is implemented via a new FirestoreRequestClient wrapper that appends these headers to each request. The reviewer recommended updating the operator == and hashCode overrides in the Settings class to include the new headers and existing environmentOverride fields. Additionally, it was suggested to wrap the headers in Map.unmodifiable when initializing FirestoreRequestClient to prevent external modifications.
… into firestore/settings-headers
Coverage Report✅ Coverage 75.53% meets 40% threshold Total Coverage: 75.53% Package Breakdown
Minimum threshold: 40% |
* fix(admin): attach usage-tracking headers to Firestore requests * refactor(admin): share usage-tracking header values between FirebaseUserAgentClient and Firestore * fix(admin): avoid duplicate gl-dart tag when tagging Firestore requests * fix(admin): address review feedback, merge rather than replace user headers * docs(admin): wrap CHANGELOG entry to match surrounding style * refactor(admin): extract shared identity strings to avoid duplicating them across the two header maps
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Adds
Settings.headersso callers can attach custom HTTP headers (usage-tracking, tracing, etc.) to every outgoing Firestore request without supplying a full custom HTTP client.FirestoreHttpClientwraps its authenticated client in a newFirestoreRequestClientwhenever headers are set.Needed by #308, which uses this to tag Admin-SDK-originated Firestore traffic.