fix(api): add Content-Type header to POST/PATCH requests

✅ merged · #18 · Edu-Carone-SA/mike ← Edu-Carone-SA/mike · opened 1mo ago by EduardoCarone · merged 1mo ago by EduardoCarone · self · +2-1 across 2 files · ↗ on GitHub

From the PR description

Bug fix: "Valid email is required" when creating users

Root cause: apiRequest() in mikeApi.ts did not set Content-Type: application/json in the request headers. Express express.json() middleware only parses the request body when Content-Type is application/json. Without it, req.body was empty, so email was undefined → backend returned 400 "Valid email is required".

Fix: Add Content-Type: application/json to the default headers in apiRequest().

Affected: All POST/PATCH admin endpoints (create user, change role, disable, enable, reset password, revoke sessions).

Tests: 85 frontend tests green, typecheck clean, lint clean.

Our analysis

Fix JSON headers for admin user actions — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-18.md from inside the repo you want the changes in.

⬇ Download capture-pull-18.md