Follows #3368, which fixed the Flask and Docker backends and left this case open deliberately.
What happens
Real Vuforia returns a 404 for a request to a path it does not serve, and for a request to a served path with a method that path does not serve. The Flask and Docker mock now does the same.
The requests and httpx backends register only the URLs they serve, so any other request under https://vws.vuforia.com never reaches the mock. responses raises requests.exceptions.ConnectionError and respx raises httpx.ConnectError (see _block_unmatched in src/mock_vws/_respx_mock_server/decorators.py).
tests/mock_vws/test_unrouted_requests.py branches on the backend for exactly this reason: it asserts a 404 against real Vuforia and the Flask app, and no response at all against MockVWS.
Why it matters
A typo in a path, a newer VWS endpoint, or a health probe gives a connection error under MockVWS and a 404 in production. Code with a except ConnectionError retry loop, or code which treats a 404 as a permanent failure, behaves differently against the mock than against Vuforia. This is the same class of surprise as #3368, in the backends that issue did not cover.
The counter-argument
The connection error is the documented behaviour for requests to addresses the mock does not handle, and it is a useful signal in tests: it says loudly that the mock does not implement an endpoint, where a silent 404 could be mistaken for a real Vuforia 404. Serving a catch-all also changes what real_http=True passes through, which needs care.
Suggested resolution
Decide whether MockVWS should register a catch-all under base_vws_url returning the same 404 the Flask app returns, so that all three backends agree, and keep the connection error only for other hosts. If so, real_http=True must still pass unserved paths through to the real server.
Whatever is decided, update the "Paths which the mock does not serve" section of docs/source/differences-to-vws.rst, which currently records this as a difference, and remove the VuforiaBackend.MOCK branches from tests/mock_vws/test_unrouted_requests.py if the difference goes away.
Follows #3368, which fixed the Flask and Docker backends and left this case open deliberately.
What happens
Real Vuforia returns a 404 for a request to a path it does not serve, and for a request to a served path with a method that path does not serve. The Flask and Docker mock now does the same.
The
requestsandhttpxbackends register only the URLs they serve, so any other request underhttps://vws.vuforia.comnever reaches the mock.responsesraisesrequests.exceptions.ConnectionErrorandrespxraiseshttpx.ConnectError(see_block_unmatchedinsrc/mock_vws/_respx_mock_server/decorators.py).tests/mock_vws/test_unrouted_requests.pybranches on the backend for exactly this reason: it asserts a 404 against real Vuforia and the Flask app, and no response at all againstMockVWS.Why it matters
A typo in a path, a newer VWS endpoint, or a health probe gives a connection error under
MockVWSand a 404 in production. Code with aexcept ConnectionErrorretry loop, or code which treats a 404 as a permanent failure, behaves differently against the mock than against Vuforia. This is the same class of surprise as #3368, in the backends that issue did not cover.The counter-argument
The connection error is the documented behaviour for requests to addresses the mock does not handle, and it is a useful signal in tests: it says loudly that the mock does not implement an endpoint, where a silent 404 could be mistaken for a real Vuforia 404. Serving a catch-all also changes what
real_http=Truepasses through, which needs care.Suggested resolution
Decide whether
MockVWSshould register a catch-all underbase_vws_urlreturning the same 404 the Flask app returns, so that all three backends agree, and keep the connection error only for other hosts. If so,real_http=Truemust still pass unserved paths through to the real server.Whatever is decided, update the "Paths which the mock does not serve" section of
docs/source/differences-to-vws.rst, which currently records this as a difference, and remove theVuforiaBackend.MOCKbranches fromtests/mock_vws/test_unrouted_requests.pyif the difference goes away.