Skip to content

Conversation

@typotter
Copy link
Collaborator

@typotter typotter commented Jan 23, 2026

Configuration Source Extraction part 4/5 - Integrate Default HTTP Client

🥞 Configuration Refactor Stacked Pull Requests 🥞

🔲 Make HTTP client injectable via constructor (#207)
👉 Integrate default HTTP client implementation (this PR)
✅ Add configuration HTTP client interface (#205)
✅ Add flagsSnapshotId field to Configuration (#208)
✅ Extract DTO interfaces for downstream SDK extensibility (#197)
⬇️ feature/v4 (trunk)

Motivation and Context

PR #205 extracted the IEppoConfigurationHttpClient interface, but without a concrete implementation, the SDK cannot actually fetch configurations.

This PR provides a default implementation using OkHttp that:

  1. Implements the interface: Concrete DefaultEppoConfigurationHttpClient class
  2. Handles JSON parsing: Deserializes flag and bandit configurations using Jackson
  3. Integrates with existing code: Drops into ConfigurationRequestor seamlessly
  4. Preserves all functionality: Maintains ETag caching, polling, callbacks, etc.
  5. Sets the pattern: Reference implementation for downstream SDKs

This allows the SDK to continue working out-of-the-box while enabling downstream SDKs to provide alternative implementations.

Description

Create DefaultEppoConfigurationHttpClient - an OkHttp-based implementation of IEppoConfigurationHttpClient and integrate it into the existing codebase.

Implementation Details

DefaultEppoConfigurationHttpClient:

  • Uses OkHttp Call for HTTP requests
  • Jackson ObjectMapper for JSON deserialization
  • Handles ETags for caching (304 Not Modified responses)
  • Error handling with proper status codes and messages
  • Both synchronous and asynchronous methods

Integration Changes

ConfigurationRequestor:

  • Now accepts IEppoConfigurationHttpClient in constructor
  • Uses new interface instead of direct EppoHttpClient calls
  • Maintains all existing behavior (polling, callbacks, caching)

BaseEppoClient:

  • Creates DefaultEppoConfigurationHttpClient instance
  • Passes to ConfigurationRequestor
  • No changes to public API

How has this been documented?

  • Comprehensive Javadoc on DefaultEppoConfigurationHttpClient
  • Clear implementation of interface contracts
  • Internal implementation details documented

How has this been tested?

  • All existing tests pass (275+ tests)
  • Existing integration tests verify the implementation works correctly
  • Default implementation maintains backward compatibility

Breaking Changes

None. The SDK continues to work exactly as before, using the default OkHttp-based implementation.

Dependencies

Depends on: PR #205 (typo/flag-source-interface)
Blocks: PR #207

@typotter typotter marked this pull request as draft January 23, 2026 17:05
@typotter typotter changed the title Configuration Source Extraction part 3/4 - Integrate Default HTTP Client Configuration Source Extraction part 3/3 - Integrate Default HTTP Client Jan 23, 2026
@typotter typotter force-pushed the typo/integrate-http-client branch from 06e48a0 to 3959bd1 Compare January 23, 2026 17:23
@typotter typotter changed the title Configuration Source Extraction part 3/3 - Integrate Default HTTP Client Configuration Source Extraction part 3/4 - Integrate Default HTTP Client Jan 23, 2026
@typotter typotter changed the title Configuration Source Extraction part 3/4 - Integrate Default HTTP Client Configuration Source Extraction part 4/5 - Integrate Default HTTP Client Jan 23, 2026
@typotter typotter force-pushed the typo/flag-source-interface branch from 32638b2 to 5644864 Compare January 23, 2026 21:51
@typotter typotter force-pushed the typo/integrate-http-client branch from 9fbd452 to 5c94b16 Compare January 23, 2026 21:58
Introduces a new default HTTP client for fetching Eppo configuration that
uses OkHttp and Jackson with EppoModule for JSON parsing.

Key features:
- Async-only methods returning CompletableFuture
- ETag support via If-None-Match header for conditional requests
- 10-second timeouts for HTTP operations
- Type-safe responses with parsed configuration objects
- API key redaction in error messages
- Comprehensive error handling (200, 304, 403, 500)

This implementation is standalone and does not yet integrate with the
existing codebase. Integration will come in a follow-up PR.

Also includes:
- Comprehensive unit tests using MockWebServer
- Tests for ConfigurationRequest, ConfigurationResponse, and
  ConfigurationRequestFactory
- Fix for import in ConfigurationRequestFactory
This commit completes the integration of the new HTTP client:

Core integration changes:
- Update IEppoConfigurationHttpClient to async-only (remove sync methods)
- Update Configuration.Builder to accept IFlagConfigResponse and
  IBanditParametersResponse directly
- Add endpoint-specific methods to ConfigurationRequestFactory
- Update ConfigurationRequestor to use new client interface with
  ConfigurationResponse handling
- Update BaseEppoClient to use DefaultEppoConfigurationHttpClient

Removed legacy code:
- EppoHttpClient.java
- EppoHttpClientRequestCallback.java
- EppoHttpClientTest.java

Test updates:
- Update ConfigurationRequestorTest with new mocking strategy
- Update BaseEppoClientTest for new client interface
- Update TestUtils helper methods for IEppoConfigurationHttpClient

All 279+ tests pass successfully.
@typotter typotter force-pushed the typo/integrate-http-client branch from 5c94b16 to a5cbd1d Compare January 23, 2026 22:35
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.

2 participants