Skip to content

[AI-FSSDK] (DO NOT REVIEW) [FSSDK-12273] Add support for custom headers in polling datafile managers#489

Open
raju-opti wants to merge 1 commit intomasterfrom
ai/raju-opti/FSSDK-12273-custom-headers
Open

[AI-FSSDK] (DO NOT REVIEW) [FSSDK-12273] Add support for custom headers in polling datafile managers#489
raju-opti wants to merge 1 commit intomasterfrom
ai/raju-opti/FSSDK-12273-custom-headers

Conversation

@raju-opti
Copy link

@raju-opti raju-opti commented Feb 5, 2026

Summary

This PR adds support for custom headers in polling datafile managers (PollingConfigManager and AuthDatafilePollingConfigManager). Users can now pass custom headers when initializing the SDK client instance, which will be included in HTTP requests to fetch the datafile.

Reference implementation: optimizely/javascript-sdk#1107

Changes

  • Added custom_headers parameter to PollingConfigManager.__init__()
  • Added custom_headers parameter to Optimizely.__init__() and passed to config managers
  • Updated fetch_datafile() methods to merge custom headers with internal headers
  • User-provided headers take precedence over SDK internal headers
  • Added comprehensive test coverage for custom headers functionality

Usage Example

```python
from optimizely import optimizely

Initialize SDK with custom headers

client = optimizely.Optimizely(
sdk_key='your_sdk_key',
custom_headers={
'X-Custom-Header': 'custom_value',
'Authorization': 'Bearer custom_token' # Overrides internal auth if needed
}
)
```

Testing

Added test cases covering:

  • Custom headers included in datafile fetch requests
  • Custom headers override internal SDK headers (including `If-Modified-Since` and `Authorization`)
  • Both `PollingConfigManager` and `AuthDatafilePollingConfigManager` support custom headers

Related

🤖 Generated with Claude Code

…gers

This change adds support for custom headers in PollingConfigManager and
AuthDatafilePollingConfigManager. Users can now pass custom headers when
initializing the SDK client instance, which will be included in HTTP
requests to fetch the datafile.

Key changes:
- Added custom_headers parameter to PollingConfigManager.__init__()
- Added custom_headers parameter to AuthDatafilePollingConfigManager (inherited)
- Added custom_headers parameter to Optimizely.__init__() and passed to config managers
- Updated fetch_datafile() methods to merge custom headers with internal headers
- User-provided headers take precedence over SDK internal headers
- Added comprehensive test coverage for custom headers functionality

Reference: optimizely/javascript-sdk#1107

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant