Skip to content

Conversation

@oguzkocer
Copy link
Contributor

@oguzkocer oguzkocer commented Nov 25, 2025

Allow OkHttp interceptors to be passed to DefaultHttpClient while preserving hostname verification functionality. Add a convenience constructor to WpRequestExecutor that accepts interceptors directly.

This enables clients to inject interceptors (e.g., for network debugging) without needing to manage OkHttpClient configuration.

Changes:

  • Add interceptors parameter to DefaultHttpClient
  • Refactor to use buildClient() method for client construction
  • Add convenience constructor to WpRequestExecutor

Part of CMM-998

Allow OkHttp interceptors to be passed to DefaultHttpClient while
preserving hostname verification functionality. Add a convenience
constructor to WpRequestExecutor that accepts interceptors directly.

This enables clients to inject interceptors (e.g., for network
debugging) without needing to manage OkHttpClient configuration.

Changes:
- Add `interceptors` parameter to `DefaultHttpClient`
- Refactor to use `buildClient()` method for client construction
- Add convenience constructor to `WpRequestExecutor`
@oguzkocer oguzkocer added this to the 0.2 milestone Nov 25, 2025
@oguzkocer oguzkocer enabled auto-merge (squash) November 25, 2025 17:41
Remove default values for interceptors throughout the client chain,
requiring consumers to explicitly pass interceptors (even if empty).
This makes the API more intentional and prevents silent defaults.

Changes:
- Fix initialization order bug in `DefaultHttpClient` (allowedHostnames before client)
- Remove default `interceptors` parameter from `DefaultHttpClient`
- Remove default `httpClient`/`requestExecutor` from all API clients
- Add convenience constructors accepting `List<Interceptor>` to all clients
- Update all call sites to pass `emptyList()` explicitly
@oguzkocer oguzkocer force-pushed the flexible-ok-http-builder branch from 021dea0 to aa9ec22 Compare November 25, 2025 18:49
The custom WpRequestExecutorHostnameVerifier doesn't handle wildcards
or SANs like the default OkHttp verifier. Only apply it when there are
actually allowed hostname overrides configured.
@oguzkocer oguzkocer requested a review from jkmassel November 26, 2025 13:20
@oguzkocer oguzkocer merged commit 691cb72 into trunk Nov 26, 2025
22 checks passed
@oguzkocer oguzkocer deleted the flexible-ok-http-builder branch November 26, 2025 16:54
oguzkocer added a commit to wordpress-mobile/WordPress-Android that referenced this pull request Nov 27, 2025
Pass empty interceptors list to API client constructors following the
addition of interceptors support in wordpress-rs.

Automattic/wordpress-rs#1041

Changes:
- Update `WpApiClient`, `WpLoginClient`, and `WpRequestExecutor` calls
  to include `interceptors = emptyList()`
- Bump wordpress-rs version in libs.versions.toml
oguzkocer added a commit to wordpress-mobile/WordPress-Android that referenced this pull request Nov 27, 2025
Pass empty interceptors list to API client constructors following the
addition of interceptors support in wordpress-rs.

Automattic/wordpress-rs#1041

Changes:
- Update `WpApiClient`, `WpLoginClient`, and `WpRequestExecutor` calls
  to include `interceptors = emptyList()`
- Bump wordpress-rs version in libs.versions.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants