Skip to content

fix(api): return JSON errors instead of empty success responses - #255

Draft
n30nex wants to merge 1 commit into
devfrom
codex/api-json-response-20261020
Draft

n30nex wants to merge 1 commit into
devfrom
codex/api-json-response-20261020

Conversation

@n30nex

@n30nex n30nex commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

If JSON encoding failed, the shared response helper had already committed HTTP 200 and returned an empty body. Encode before writing headers and return the standard structured 500 response on failure. Successful responses keep their JSON content type and trailing newline; network write failures are logged separately.

Validation:

  • The new NaN/unsupported-type regression failed before the fix and passes afterward.
  • Local build, vet, full Go tests and vulnerability checks passed.
  • Full Linux/PostgreSQL CI passed.
  • Swagger regenerated with no schema changes.

Closes #254.

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.

Avoid empty HTTP 200 responses when JSON encoding fails

1 participant