Skip to content

fix(client): preserve URL components when appending endpoint paths - #753

Draft
Kayvan-Zahiri wants to merge 1 commit into
workos:mainfrom
Kayvan-Zahiri:codex/base-url-components
Draft

Kayvan-Zahiri wants to merge 1 commit into
workos:mainfrom
Kayvan-Zahiri:codex/base-url-components

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

When a proxy base_url contains a query string or fragment, URL construction appends the endpoint to the raw URL rather than its path. For example, listing organizations against https://proxy.example/prefix?route=a%2Fb sends a request to /prefix and moves /organizations into the query. SSO/AuthKit authorization URLs have the same problem. Per-request base_url overrides are affected too.

Join the endpoint onto the parsed path, preserve the existing query and fragment, and append encoded operation parameters to the query. Normalize a trailing slash on the path rather than appending it after a query or fragment. Existing no-query/no-fragment behavior is covered by controls.

This changes only the hand-maintained @oagen-ignore-file base client and a similarly marked test file. Generated resources, schemas, authentication logic, and version/release files are untouched.

Thirty public-client regression/control cases cover sync/async organization requests, constructor and per-request base URLs, and SSO/AuthKit authorization URLs, using an httpx2.MockTransport for HTTP requests. Eighteen fail before the fix; twelve controls pass. All 2,994 repository tests pass after the change. Repository-wide Ruff lint/format and Pyright pass (zero errors/warnings). Wheel and source distribution builds pass independently with a fresh cache; the initial combined uv build failed while extracting an archive. No live WorkOS request or account was used. Developed with AI assistance and verified locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant