[codex] add setApiUrl builder support#5
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the SDK's network configuration flexibility by introducing a public method to customize the API base URL. This change allows users to direct SDK traffic through alternative HTTPS endpoints, such as proxies or edge relays, which is crucial for environments with restrictive network policies. The new functionality includes robust validation to ensure URL integrity and security. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature allowing users to specify a custom API URL, which is particularly useful for environments with network restrictions. The implementation is clean, and the accompanying tests cover the primary validation scenarios. I have one suggestion to improve the robustness of the URL handling to prevent potential issues with malformed URLs when query parameters or fragments are present in the user-provided URL.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds public builder support for overriding the SDK’s base API URL, enabling integrators to route traffic through a custom HTTPS proxy endpoint while keeping the existing network stack behavior.
Changes:
- Introduced
setApiUrl(apiUrl: string)onQonversionConfigBuilderwith URL validation/normalization. - Updated config build to use the builder-provided
apiUrlinstead of theAPI_URLconstant. - Added unit tests covering default/custom API URL behavior and validation cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| sdk/src/QonversionConfigBuilder.ts | Adds apiUrl state + setApiUrl() validation/normalization and wires it into build() network config. |
| sdk/src/tests/QonversionConfigBuilder.test.ts | Adds tests for custom API URL override, normalization, and invalid input handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Addressed the latest review comments in Changes made:
Verification passed:
|
Summary
This change adds
setApiUrl()toQonversionConfigBuilderso integrators can override the defaulthttps://api.qonversion.iobase URL with a custom HTTPS endpoint.The immediate use case is routing SDK traffic through a trusted proxy hostname when
qonversion.iois blocked by restrictive firewall or network policy rules. Before this change, the SDK hard-coded the API base URL during configuration build, so consumers had no supported way to point requests at an alternate hostname without patching the package or mutating internal config state.Root Cause
The lower networking layers were already designed to consume
networkConfig.apiUrl, but the public builder API always populated that field from theAPI_URLconstant. In practice, the SDK had an internal injection point but no public configuration surface.That meant consumers could not safely use a reverse proxy, Cloudflare Worker hostname, or any other compliant HTTPS relay endpoint, even though the request configurator and dependency assembly already supported an injected base URL.
Fix
The builder now exposes
setApiUrl(apiUrl: string): QonversionConfigBuilder.The method validates and normalizes the provided URL before storing it in the config that is passed through the existing network stack:
No lower-level networking behavior changed. The request configurator and assemblies continue to read
networkConfig.apiUrl; this change only makes that value publicly configurable in a supported way.User Impact
Consumers can now initialize the SDK like this:
This enables the SDK to operate behind an alternate hostname, such as an HTTPS proxy or edge relay, without forking the package or relying on internal implementation details.
Validation
I verified the change with:
pnpm exec jest sdk/src/__tests__/QonversionConfigBuilder.test.ts --runInBand --watchman=falsepnpm buildpnpm test -- --runInBandThe builder tests now cover: