Skip to content

fix: normalize API error responses - #24

Merged
isthatpratham merged 1 commit into
mainfrom
fix/api-json-error-responses
Aug 30, 2026
Merged

isthatpratham merged 1 commit into
mainfrom
fix/api-json-error-responses

Conversation

@isthatpratham

Copy link
Copy Markdown
Owner

Summary

  • Unknown /api routes now return { success: false, message: "Not found" } instead of Express HTML
  • Invalid JSON bodies return 400 Invalid JSON without echoing the payload or stack
  • Existing handlers already used structured JSON; this closes the remaining gaps

Testing

  • npm test -- src/__tests__/apiErrors.test.ts src/__tests__/spaServing.test.ts src/__tests__/apiE2E.test.ts passed
  • npm run build succeeded

Unknown /api paths were falling through to Express HTML 404s, and body-parser SyntaxError leaked as a 500. Always respond with { success, message } and never echo the request body.
@isthatpratham
isthatpratham merged commit 7404a0c into main Aug 30, 2026
1 check passed
@isthatpratham
isthatpratham deleted the fix/api-json-error-responses branch August 30, 2026 23:39
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.

1 participant