Fix urljoin bug with base URL path prefixes#2994
Merged
adamtheturtle merged 3 commits intomainfrom Feb 22, 2026
Merged
Conversation
Replace urljoin with string concatenation in URL pattern construction to preserve path prefixes in base URLs. This fixes the issue where MockVWS(base_vws_url="http://localhost/prefix") would incorrectly register handlers at http://localhost/targets instead of http://localhost/prefix/targets. Add tests for path prefix handling in both requests_mock and respx implementations. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Normalize httpx header keys to title case in _to_request_data so that validators can find headers like Authorization and Content-Type, which httpx stores as lowercase. This enables properly-authenticated requests through the respx mock. Add test_vumark_bytes_response to exercise the bytes response path in the respx callback, which is only reachable via the vumark endpoint with valid authentication. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Feb 22, 2026
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
Replace
urljoin()with string concatenation to preserve path prefixes in base URLs. This fixes an issue whereMockVWS(base_vws_url="http://localhost/prefix")would incorrectly register handlers athttp://localhost/targetsinstead ofhttp://localhost/prefix/targets.Add comprehensive tests for path prefix handling in both
requests_mockandrespximplementations. The fix ensures path prefixes are properly preserved when constructing URL patterns for the mock interceptors.Test plan
TestCustomBaseURLspass🤖 Generated with Claude Code
Note
Low Risk
Small, localized change to URL-pattern construction plus additional tests; main risk is regressions in route matching for edge-case base URLs.
Overview
Fixes mock route registration when
base_vws_url/base_vwq_urlinclude a path prefix by replacingurljoin()with explicitbase_url.rstrip("/") + route.path_patternconcatenation in both therequests(responses) andhttpx(respx) decorators.Adds coverage to ensure prefixed base URLs only intercept requests under the prefix (and not the root), and updates the
httpxadapter to normalize request header casing; also adds anhttpxtest asserting the VuMark instances endpoint returns a bytes response successfully.Written by Cursor Bugbot for commit 0d726d2. This will update automatically on new commits. Configure here.