Summary
ValidateRepoHandler.post() calls json.loads(self.request.body) without guarding JSONDecodeError, causing a 500 on malformed request payloads.
Why this matters
Invalid client input should produce deterministic 4xx responses, not internal server errors.
Current behavior
Malformed JSON can bubble up as an unhandled exception and return 500.
Expected behavior
Malformed JSON should return 400 Bad Request with a clear error message.
Proposed fix
- Wrap JSON parsing with
try/except (json.JSONDecodeError, ValueError).
- Return
HTTPError(400, "Invalid JSON body") (consistent with other handlers).
- Add tests for malformed payload handling.
Acceptance criteria
- Malformed JSON returns 400.
- Valid payload behavior is unchanged.
- Tests cover invalid and valid cases.
Summary
ValidateRepoHandler.post()callsjson.loads(self.request.body)without guardingJSONDecodeError, causing a 500 on malformed request payloads.Why this matters
Invalid client input should produce deterministic 4xx responses, not internal server errors.
Current behavior
Malformed JSON can bubble up as an unhandled exception and return 500.
Expected behavior
Malformed JSON should return
400 Bad Requestwith a clear error message.Proposed fix
try/except (json.JSONDecodeError, ValueError).HTTPError(400, "Invalid JSON body")(consistent with other handlers).Acceptance criteria