Skip to content

fix(api): return 400 for invalid write bodies#38

Open
Lubrsy706 wants to merge 1 commit into
cloudflare:mainfrom
Lubrsy706:fix/safe-parse-write-routes
Open

fix(api): return 400 for invalid write bodies#38
Lubrsy706 wants to merge 1 commit into
cloudflare:mainfrom
Lubrsy706:fix/safe-parse-write-routes

Conversation

@Lubrsy706
Copy link
Copy Markdown

Fixes #16.

Summary

  • add a shared parseJsonBody helper that catches malformed JSON and Zod validation failures
  • convert mailbox, send, draft, email update/move, folder, reply, and forward write routes to return 400 for invalid bodies
  • add schemas for previously unchecked write bodies such as folder updates and email move requests

Tests

  • npm run typecheck

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.

Standardize write-route input validation on safeParse + 400

1 participant