Fix validators when base URL has a path prefix#2996
Merged
adamtheturtle merged 1 commit intomainfrom Feb 22, 2026
Merged
Conversation
When MockVWS or MockVWSForHttpx is configured with a base_vws_url containing a path prefix (e.g. https://example.com/prefix), strip the prefix from the request path before passing it to validators and route handlers. Previously, validators performing path-length checks (e.g. validate_target_id_exists, validate_keys, validate_name_*) received the full prefixed path and incorrectly parsed it, causing spurious errors such as UnknownTarget for endpoints that take no target ID. Fixes #2995. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MockVWSorMockVWSForHttpxis configured with abase_vws_urlcontaining a path prefix (e.g.https://example.com/prefix), the full request path (including prefix) was passed to validators and route handlers unchangedvalidate_target_id_exists,validate_keys,validate_name_*) incorrectly treated the extra path segments as part of the API path, causing spurious errors_wrap_callback(requests mock) and_make_callback/_to_request_data(respx mock) before constructingRequestData, so all validators and handlers always see the API-relative pathTest plan
test_vws_operations_work_with_path_prefixto bothtest_requests_mock_usage.pyandtest_respx_mock_usage.pyTestCustomBaseURLstests continue to pass🤖 Generated with Claude Code
Note
Low Risk
Small, localized change to request path normalization in mock callbacks plus targeted regression tests; low chance of unintended impact outside prefixed base-URL usage.
Overview
Fixes
MockVWS(responses/requests) andMockVWSForHttpx(respx/httpx) whenbase_vws_url/base_vwq_urlinclude a path prefix by stripping the parsedbase_urlpath from incoming request paths before buildingRequestData, so route handlers and path-based validators see consistent API-relative paths.Adds regression tests for both clients that perform an authenticated
GET /targetsagainst a prefixed base URL and assert a successful empty result set.Written by Cursor Bugbot for commit 7775aed. This will update automatically on new commits. Configure here.