Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include response bodies in the json output #1907

Open
1 task
kidbrax opened this issue Sep 8, 2023 · 8 comments
Open
1 task

include response bodies in the json output #1907

kidbrax opened this issue Sep 8, 2023 · 8 comments
Labels
enhancement New feature or request topic: reports
Milestone

Comments

@kidbrax
Copy link

kidbrax commented Sep 8, 2023

Problem to solve

I need a way to capture all the response bodies from a series of requests.

Proposal

I'd like to have the response bodies included in the --json output. This way I could filter down to exactly the output I want. Or just return all response bodies from the command instead of just the last one when not using json output.

Additional context and resources

As of now, I am using ver-verbose and redirecting stderr to a file which has all the responses. But hten I have to parse thorugh all the other info that I don't need.

Tasks to complete

  • ...
@kidbrax kidbrax added the enhancement New feature or request label Sep 8, 2023
@jcamiel
Copy link
Collaborator

jcamiel commented Sep 9, 2023

Hi, it seems reasonable. My only question: what should be the default behaviour of --json? Do we include request and response body by default or to we add another flag (--json-full etc...) to activate it...

@kidbrax
Copy link
Author

kidbrax commented Sep 9, 2023

Good question. When I first used it, I assumed the body would be included in the json by default. Seems unintuitive to include everything else and not the body. Thanks for the follow up!

@jcamiel jcamiel modified the milestone: 4.1.0 Sep 11, 2023
@selfagency
Copy link

for my two cents: i think it should be the default. it struck me as odd that using the --json flag only provided metadata and not the result of the request unless i also added --very-verbose, and then the response came through on stderr instead of stdout. i'd prefer it if including the response body was default behavior but also wish --json-full existed and included all debug data included in the --very-verbose output but as json.

@fabricereix
Copy link
Collaborator

now, I would also include it by default.
We hadn't included initially mostly to be consistent with the HAR format.

@jcamiel
Copy link
Collaborator

jcamiel commented Sep 28, 2023

See also this discussion

@jcamiel
Copy link
Collaborator

jcamiel commented Oct 29, 2023

See also @iBicha comment => #1969 (comment)

@fabricereix
Copy link
Collaborator

fabricereix commented Nov 8, 2023

here a possible solution relating to JSON output and body:

  • keep --json option as it is now (without body)
  • add --report-json option similar to --report-html that will keep all the responses in separate files without escaping. The JSON will simply includes the filename.
  • in order to get response in the output, use the write-out option
  • add --json-full option with all available data (body included in base64)

@jcamiel jcamiel modified the milestones: 4.2.0, 4.3.0 Jan 10, 2024
@jcamiel jcamiel modified the milestones: 4.3.0, 5.0.0 Apr 17, 2024
@jcamiel
Copy link
Collaborator

jcamiel commented Jun 9, 2024

--report-json has been merged on master (5.0.0-SNAPSHOT): there is now a report.json file referencing each HTTP responses of the run dumped to disk.

@jcamiel jcamiel modified the milestones: 5.0.0, 5.1.0 Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic: reports
Projects
None yet
Development

No branches or pull requests

4 participants