wiremock does not match GitLab paths that lack the /api/v4 prefix or that decode %2F differently
Symptom#
A GitlabClient stub test returns HTTP status client error (404 Not Found) for url (http://127.0.0.1:PORT/api/v4/projects/group%2Fproject/merge_requests?...) although a Mock was mounted for what looks like the same path.
Cause#
GitlabClient builds every route on its base_url, which already ends in /api/v4, so a matcher anchored at /projects/... never matches. wiremock path matching also treats the encoded path as sent (the request keeps group%2Fproject), and path / path_regex compare against that raw form.
Fix#
Anchor the matcher at ^/api/v4/projects/group%2Fproject/merge_requests$ (use path_regex, not path), and match query values (state, source_branch) with query_param, which compares decoded values. For the current_thread tokio client code, drive the future with tokio::runtime::Handle::block_on inside spawn_blocking rather than building a fresh runtime there.
Evidence#
crates/rgit-forge/tests/gitlab.rs: the first matcher set (^/projects/group%2Fproject/merge_requests$) failed all 4 tests; with the /api/v4 prefix all 4 passed. Confirmed 2026-10-10 while adding ensure_pull_request stub tests.
Also found by searching
- wiremock 404 Not Found although the URL matches
- wiremock path matcher GitLab encoded project path owner%2Frepo
- HTTP status client error (404 Not Found) for url merge_requests wiremock stub