Repository navigation
feat: Support custom reqwest clients - #263
Merged
Merged
Conversation
|
The PR appears safe to merge with no actionable correctness, security, compatibility, or repository-rule issues identified. Reviews (1) · Last reviewed commit: "feat: Support custom reqwest clients" |
Contributor
posthog-rs-v0 Compliance ReportDate: 2026-09-24 08:35:21 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Contributor
posthog-rs-v1 Compliance ReportDate: 2026-09-24 08:36:18 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
marandaneto
marked this pull request as ready for review
September 23, 2026 11:25
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 3 · PR risk: 0/10 |
ioannisj
approved these changes
Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Closes #262. Related to #256 and #257.
Public API change: add
ClientOptionsBuilder::http_client(reqwest::Client)andblocking_http_client(reqwest::blocking::Client). The API shape was approved on #262.Applications can now share their HTTP connection pools, proxies, TLS settings, and timeouts with the SDK. The async client handles immediate capture, remote flags, and local-evaluation polling. The blocking client handles blocking requests and background capture in both SDK modes. Omitting either option preserves SDK-created clients for that path.
SDK timeout options also apply to supplied clients.
request_timeout_secondsbounds immediate capture, background capture, and initial and periodic local-evaluation requests.feature_flags_request_timeout_secondsbounds remote flags. These options replace the supplied request timeout even if it is shorter. Background shutdown draining additionally caps requests at the remaining shutdown deadline.shutdown_timeout_msis not a hard limit on the total wait for work already underway; this limitation is documented above the custom-client setters. No shutdown lifecycle behavior is changed.The SDK releases its blocking-client handles outside the async runtime, including disabled initialization and cancellation. Construction also works outside Tokio when local evaluation is disabled. Background initialization task failures are logged. Documentation warns against supplying clients with default headers or cookies containing credentials for unrelated services.
This is separate from the TLS-provider selection added to
v1in #245. This PR targetsmainand does not add that feature or disable background transport.Includes a usage example, documentation, public API snapshot, and minor changeset.
💚 How did you test it?
cargo test --workspacecargo test --no-default-featurescargo test --features capture-v1cargo test --no-default-features --features capture-v1,error-trackingcargo fmt --all -- --checkcargo clippy -- -D warningscargo check --examplescargo check --example custom_http_clients --no-default-featuresscripts/check-public-api.sh0f81997againstorigin/mainreported no actionable findings.📝 Checklist
If releasing new changes
sampo addto generate a changeset file