Skip to content

fix(checkins): omit JSON headers for body-less actions - #797

Merged
unjica merged 1 commit into
developfrom
fix/checkin-empty-json-body
Oct 12, 2026
Merged

unjica merged 1 commit into
developfrom
fix/checkin-empty-json-body

Conversation

@unjica

@unjica unjica commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Rotate URL, Pause, Resume, and Delete sent Content-Type: application/json without a body, causing Fastify to reject them with FST_ERR_CTP_EMPTY_JSON_BODY. Check-in server actions now include the JSON header only when a body is provided, including falsy JSON values.

Dashboard tests cover missing headers/body for POST and DELETE action suffixes and JSON serialization for provided bodies. Four database regression cases reproduce the old 400, verify no mutation, and assert the corrected request succeeds with 200. Fastify remains strict: changing parsing would add unnecessary API behavior to this narrowly scoped dashboard fix. Existing page/client error handling already catches load and mutation failures.

Validation:

  • pnpm lint: passed.
  • pnpm --filter dashboard test: 60 files, 354 tests passed.
  • RUN_DB_INTEGRATION_TESTS=true pnpm --filter api test: 167 files passed, 1 skipped; 1,387 tests passed, 8 skipped. Includes all 16 check-in database tests.
  • pnpm build: passed across the workspace.
  • API and dashboard tsc --noEmit: respectively 106 and 6 existing diagnostics, identical to base with changed source/test files restored temporarily for comparison; no new diagnostics. Build type validation passed.

Database tests used only the requested disposable rotpg PostgreSQL 16 container at localhost:55435; migrations applied there and container stopped afterward.

Other dashboard actions audited: dashboard/actions.ts, auth/actions.ts, marketing/actions.ts, contact/actions.ts, affiliates/actions.ts, dashboard/settings/agent-access/actions.ts, and dashboard/settings/affiliates/actions.ts. No equivalent empty-JSON-body case found. The optional-body affiliate helper serializes body ?? {}; other JSON requests provide a body and body-less DELETE requests omit that header.

No merge, deploy, publishing, or production data access.

Only send JSON content-type when a request body is provided. Cover dashboard
request construction and all four management routes against throwaway Postgres.
Keep Fastify JSON parsing strict and document the fix in Unreleased.
@unjica
unjica merged commit 755824e into develop Oct 12, 2026
7 checks passed
@unjica unjica mentioned this pull request Oct 12, 2026
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