Skip to content

[FEEDS-1373] allow users to provide a custom OkHttpClient#53

Merged
itsmeadi merged 2 commits intomainfrom
expose-http-client
Apr 10, 2026
Merged

[FEEDS-1373] allow users to provide a custom OkHttpClient#53
itsmeadi merged 2 commits intomainfrom
expose-http-client

Conversation

@itsmeadi
Copy link
Copy Markdown
Contributor

Summary

  • Add new constructors on StreamHTTPClient and StreamSDKClient that accept a user-provided OkHttpClient, giving full control over connection pool, timeouts, proxy, SSL, and any other OkHttp setting.
  • The SDK calls client.newBuilder() on the provided client, so the user's configuration is inherited while the SDK's required interceptors (auth, logging, headers) are still applied.
  • Existing constructors are unchanged — fully backward-compatible.

Usage:

OkHttpClient customClient = new OkHttpClient.Builder()
    .connectionPool(new ConnectionPool(10, 120, TimeUnit.SECONDS))
    .connectTimeout(30, TimeUnit.SECONDS)
    .proxy(myProxy)
    .build();

var client = new StreamSDKClient(apiKey, apiSecret, customClient);

Test plan

  • Verify all existing constructors still work as before
  • Create an OkHttpClient with a custom connection pool and pass it to new StreamSDKClient(key, secret, client) — confirm the pool config is inherited
  • Confirm SDK interceptors (auth header, api_key param, X-Stream-Client header) are present on outgoing requests
  • Confirm logging interceptor is applied at default level

Made with Cursor

Accept a user-supplied OkHttpClient via new constructors on StreamHTTPClient
and StreamSDKClient. The SDK derives a new builder from the provided client
(preserving its connection pool, timeouts, proxy, SSL config, etc.) and adds
the required auth/logging/header interceptors on top.

Made-with: Cursor
Verify that a user-provided OkHttpClient's configuration (connection pool,
connect timeout, read timeout) is preserved, and that SDK interceptors are
still applied on top.

Made-with: Cursor
@itsmeadi itsmeadi force-pushed the expose-http-client branch from 6c4ca2e to 5a65825 Compare April 10, 2026 12:22
@itsmeadi itsmeadi changed the title feat: allow users to provide a custom OkHttpClient [FEEDS-1373] allow users to provide a custom OkHttpClient Apr 10, 2026
@itsmeadi itsmeadi merged commit 5c828b4 into main Apr 10, 2026
0 of 5 checks passed
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