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

console.log could show JSON content by default #1146

Closed
ppcano opened this issue Sep 5, 2019 · 2 comments · Fixed by #2375
Closed

console.log could show JSON content by default #1146

ppcano opened this issue Sep 5, 2019 · 2 comments · Fixed by #2375
Assignees
Labels
Milestone

Comments

@ppcano
Copy link
Contributor

ppcano commented Sep 5, 2019

During debugging when working with JSON format, it is common to use the console.log to see the response body.

    let body = JSON.parse(res.body);
    console.log(body);

k6 will output [object Object].

You can use JSON.stringify() if you want to see the content:

    let body = JSON.parse(res.body);
    console.log(JSON.stringify(body));

It could be good if k6 prints by default t the JSON content as browsers and node do.

@mstoykov
Copy link
Collaborator

This is (IMO) blocked by dop251/goja#162 as I really don't want for someone to console.log a circular structure and then for us to debug a very strange stacktrace/panic

@na--
Copy link
Member

na-- commented Jul 30, 2020

Ah, yeah, fair enough... 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants