Skip to content

Reject query and fragment components in custom base URLs #3

Description

@rrajpuro

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions