Skip to content
This repository was archived by the owner on Oct 30, 2026. It is now read-only.
This repository was archived by the owner on Oct 30, 2026. It is now read-only.

MockVWS drops path prefix from base URLs (urljoin bug) #2993

Closed

Description

@adamtheturtle

Problem

MockVWS uses urljoin to build the URL patterns it intercepts, e.g.:

url_pattern = urljoin(base=base_url, url=f"{route.path_pattern}$")

Because route.path_pattern starts with / (e.g. /targets, /v1/query), Python's urljoin silently discards any path component in the base URL. So if a user configures MockVWS(base_vws_url="http://localhost/prefix"), the mock registers handlers at http://localhost/targets instead of http://localhost/prefix/targets.

The same issue affects base_vwq_url.

Impact

A client library fixed to use string concatenation (base_url.rstrip("/") + path) instead of urljoin (as done in vws-python#2867) will send requests to http://localhost/prefix/targets, which the mock won't intercept, causing ConnectionError.

This makes it impossible to write a positive integration test for path-prefix base URL support without bypassing MockVWS entirely.

Fix

Replace the urljoin call in the route-registration code with string concatenation:

url_pattern = base_url.rstrip("/") + route.path_pattern + "$"

Activity

  1. adamtheturtle commented on Feb 22, 2026

    @adamtheturtle
    MemberAuthor

    Fixed in #2994, released in 2026.02.22.1.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions