Summary
Vuforia documents that failed Cloud Query requests may return an arbitrary body or no body at all. The sync and async query clients only special-case 413, the max-results text, and 5xx responses before unconditionally parsing response.text as JSON.
As a result, a documented empty/non-JSON 4xx response raises json.JSONDecodeError, losing the useful HTTP status and the library's normal response-carrying exception interface.
The response contract is documented here: https://developer.vuforia.com/library/vuforia-engine/web-api/vuforia-query-web-api/#response-message
Reproducer
Using a custom transport that returns this response:
from vws.response import Response
response = Response(
text="",
url="https://cloudreco.vuforia.com/v1/query",
status_code=400,
headers={},
request_body=b"",
tell_position=0,
content=b"",
)
both of these paths fail at json.loads(response.text):
CloudRecoService(..., transport=transport).query(image=image)
await AsyncCloudRecoService(..., transport=async_transport).query(image=image)
Actual result:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Expected behavior
Non-JSON 4xx responses should raise a stable library exception that retains the complete Response (including status, headers, and body). JSON parsing should only happen when the body is known to be JSON. Tests should cover empty and arbitrary-text 4xx responses for both clients.
Summary
Vuforia documents that failed Cloud Query requests may return an arbitrary body or no body at all. The sync and async query clients only special-case 413, the max-results text, and 5xx responses before unconditionally parsing
response.textas JSON.As a result, a documented empty/non-JSON 4xx response raises
json.JSONDecodeError, losing the useful HTTP status and the library's normal response-carrying exception interface.The response contract is documented here: https://developer.vuforia.com/library/vuforia-engine/web-api/vuforia-query-web-api/#response-message
Reproducer
Using a custom transport that returns this response:
both of these paths fail at
json.loads(response.text):Actual result:
Expected behavior
Non-JSON 4xx responses should raise a stable library exception that retains the complete
Response(including status, headers, and body). JSON parsing should only happen when the body is known to be JSON. Tests should cover empty and arbitrary-text 4xx responses for both clients.