Skip to content

Reject an empty body on VWS endpoints which take JSON - #3551

Merged
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/fix-issue-3550
Sep 6, 2026
Merged

adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/fix-issue-3550

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

Closes #3550.

An empty body given to POST /targets, PUT /targets/{target_id}, POST /targets/{target_id}/instances or the reco counts report endpoint raised an uncaught JSONDecodeError from validate_keys, because validate_json returned early for an empty body.

This matches real Vuforia instead. I checked each endpoint against the real service with a correctly signed empty body, which differs from the response suggested in the issue:

endpoint real Vuforia response
POST /targets 500 Fail
PUT /targets/{target_id} 500 Fail
POST /targets/{target_id}/instances 400 BadRequest
POST /imagetargets/databases/{database_id}/reports/recoCounts 400 Fail

validate_json now takes the request method and rejects an empty body on POST and PUT with those responses. GET and DELETE requests are unaffected.

The new test_empty_body runs against real Vuforia as well as the mock backends. Unlike the other malformed bodies which test_invalid_json.py sends, real Vuforia answers an empty body promptly, so it is not in the real-Vuforia skip list. It skips the endpoints which do not take JSON before sending anything, so it costs one request per JSON endpoint. The new test is added to the CI ci_pattern list and passes on all three backends locally.

🤖 Generated with Claude Code

An empty body given to POST /targets, PUT /targets/{id},
POST /targets/{id}/instances or the reco counts report endpoint raised an
uncaught JSONDecodeError from validate_keys, because validate_json
returned early for an empty body.

Match real Vuforia instead: 500 Fail for the target endpoints, 400 Fail
for the reco counts report and 400 BadRequest for instance generation.
Add a test which runs against real Vuforia, since an empty body is
answered promptly unlike other malformed bodies.

Closes #3550

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An empty request body raises an unhandled JSONDecodeError on every VWS endpoint which takes a body

1 participant