Skip to content

feat: response bodies in the JSON with --show-body - #17

Merged
AustinMusiku merged 4 commits into
masterfrom
show-body
Nov 10, 2026
Merged

AustinMusiku merged 4 commits into
masterfrom
show-body

Conversation

@AustinMusiku

Copy link
Copy Markdown
Owner

--json --show-body writes each response's body into its JSON line. An agent or script can then see what a POST returned without sending it a second time with curl. The waterfall never shows a body.

timeline run --json --show-body -f flow.http | jq -c 'select(.status >= 400) | {name, status, body}'
{"name":"login","status":401,"body":"{\"message\":\"Invalid credentials\"}"}

The JSON

  • New keys: every line now has body, body_encoding and body_error, flag or not, so the shape never changes. Without --show-body they're null, "" and "".
  • What body holds: the body gunzipped and otherwise as it arrived, with no pretty-printing and no redaction, so a login's body shows its token. A body that isn't UTF-8 text is base64 with "body_encoding":"base64", as in HAR. Each redirect hop has its own body.
  • When body is null: with no response, or when the request failed partway through its body. Also when the body is over 16 MiB or uses an encoding other than gzip, and then body_error gives the reason (the body is br-encoded).
  • Without --json: --show-body alone exits 2 with --show-body needs --json, and nothing is sent.

The collector

  • collect.Options.Bodies reads each body the same way bodies kept for {{login.response.body.x}} already are: same 16 MiB cap, same gunzip. The result goes in a new record.Response.Content.
  • Only the entry handed to OnEntry carries Content. The entries Run returns leave it out, so a long -n run doesn't hold every body in memory.

Elsewhere

  • curl's -o now says --json --show-body writes each response's body, and -i says --json has each response's status, and --show-body adds its body.
  • The README, run --help and SKILL.md describe --show-body. SKILL.md no longer tells agents to use curl to see a body.

Tested with go test -race at each commit. The built binary also ran against a local server: a 302 and its 401, a PNG (base64), a gzip body, and a br body (body_error).

Copilot AI balanced review requested due to automatic review settings November 10, 2026 12:16

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@AustinMusiku
AustinMusiku merged commit ee5363a into master Nov 10, 2026
1 check passed
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.

2 participants