Problem
Custom base URLs supplied through --base-url or DEFINED_BASE_URL currently accept query strings and fragments. _request then appends the endpoint directly to the configured value, producing malformed request targets.
For example:
https://proxy.example/api?token=x
combined with /v1/hosts becomes:
https://proxy.example/api?token=x/v1/hosts
The request therefore targets /api instead of /api/v1/hosts.
Proposed fix
Reject base URLs that contain query or fragment components during validation, or construct request URLs structurally so endpoint paths are composed correctly.
Acceptance criteria
--base-url rejects values containing a query component.
--base-url rejects values containing a fragment component.
DEFINED_BASE_URL follows the same validation rules.
- Tests cover query and fragment inputs.
- Existing valid base URLs, including those with path prefixes, continue to work.
Affected code
src/defined_client/cli/core.py (base URL validation around lines 147–150).
Problem
Custom base URLs supplied through
--base-urlorDEFINED_BASE_URLcurrently accept query strings and fragments._requestthen appends the endpoint directly to the configured value, producing malformed request targets.For example:
combined with
/v1/hostsbecomes:The request therefore targets
/apiinstead of/api/v1/hosts.Proposed fix
Reject base URLs that contain query or fragment components during validation, or construct request URLs structurally so endpoint paths are composed correctly.
Acceptance criteria
--base-urlrejects values containing a query component.--base-urlrejects values containing a fragment component.DEFINED_BASE_URLfollows the same validation rules.Affected code
src/defined_client/cli/core.py(base URL validation around lines 147–150).