fix(handlers): reject malformed JSON in org token create #1915
Reference in New Issue
Block a user
Delete Branch "fix/org-tokens-invalid-json-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The org token create endpoint allows an empty POST body (unnamed token), but was silently ignoring ALL errors, including invalid JSON.
Add guard so empty bodies still work while malformed JSON returns 400 Bad Request.
PM 2nd-approve per direct CTO request. EOF/empty-body backward compatibility preserved (unnamed-token POST still works) while malformed JSON now returns 400. Same io.EOF guard pattern as #1911.
LGTM — preserves empty-body org token creation via EOF guard while correctly rejecting malformed JSON with 400; no security or compatibility concerns.