Skip to content

fix(cli): keep JSON string and null bodies intact in checkly api [RED-1269] [ship] - #1581

Merged
sorccu merged 1 commit into
mainfrom
simo/red-1269-api-json-string-null
Oct 26, 2026
Merged

sorccu merged 1 commit into
mainfrom
simo/red-1269-api-json-string-null

Conversation

@sorccu

@sorccu sorccu commented Oct 26, 2026

Copy link
Copy Markdown
Member

Linear: RED-1269

Fixes #1575

checkly api mishandled two valid application/json bodies:

  • Top-level JSON string ("ok") was printed without its quotes, so --jq failed with parse error: Invalid literal. The string shortcut predates fix: preserve binary response bytes in api command #1502; since then non-JSON bodies take a separate branch, so the shortcut only ever stripped quotes from real JSON strings.
  • JSON null doubled as the empty-body sentinel, so a null body printed nothing and --jq was skipped.

Every parsed JSON value now goes through formatJson, and only a zero-length body counts as empty (a 204 still prints nothing).

New specs in api-output.spec.ts cover string and null bodies with and without --jq; all four fail on main.

🤖 Generated with Claude Code

…-1269]

A top-level JSON string was printed without its quotes, so --jq failed
to parse it, and a JSON null body was mistaken for an empty body and
dropped. Every parsed JSON value now goes through formatJson, and only
a zero-length body counts as empty.

Fixes #1575

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sorccu sorccu changed the title fix(cli): keep JSON string and null bodies intact in checkly api [RED-1269] fix(cli): keep JSON string and null bodies intact in checkly api [RED-1269] [ship] Oct 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: ship/show PR from a same-repo branch.

@sorccu
sorccu merged commit 695df03 into main Oct 26, 2026
16 checks passed
@sorccu
sorccu deleted the simo/red-1269-api-json-string-null branch October 26, 2026 17:54
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.

checkly api fails with a jq parse error on JSON string responses and suppresses JSON null responses

1 participant