Repository navigation
fix(checkins): omit JSON headers for body-less actions - #797
Merged
Merged
Conversation
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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rotate URL, Pause, Resume, and Delete sent
Content-Type: application/jsonwithout a body, causing Fastify to reject them withFST_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.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
rotpgPostgreSQL 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.