Repository navigation
feat: response bodies in the JSON with --show-body - #17
Merged
Merged
Conversation
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.
--json --show-bodywrites 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.{"name":"login","status":401,"body":"{\"message\":\"Invalid credentials\"}"}The JSON
body,body_encodingandbody_error, flag or not, so the shape never changes. Without--show-bodythey'renull,""and"".bodyholds: 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.bodyis 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 thenbody_errorgives the reason (the body is br-encoded).--json:--show-bodyalone exits 2 with--show-body needs --json, and nothing is sent.The collector
collect.Options.Bodiesreads 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 newrecord.Response.Content.OnEntrycarriesContent. The entriesRunreturns leave it out, so a long-nrun doesn't hold every body in memory.Elsewhere
-onow says--json --show-body writes each response's body, and-isays--json has each response's status, and --show-body adds its body.run --helpand SKILL.md describe--show-body. SKILL.md no longer tells agents to use curl to see a body.Tested with
go test -raceat 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).