Karate: Beautify JSON on response logs

Created on 20 Apr 2017  路  7Comments  路  Source: intuit/karate

Hello,

I would like to know if there is a way out-of-the-box to beautify JSON in the response, instead of having it 1-liner always. I know that the raw http response is logged 'as it is' but would be nice to beautify JSON, specially when testing new feature files and its endpoints.

Best,

Neill

enhancement

Most helpful comment

Yes, this is not supported out of the box, and agree that this is good to have. My only concern is performance, and I'd like to think over how best to make this enabled via a switch, I'm leaning towards something like:

* configure logging = { pretty: true }

All 7 comments

Yes, this is not supported out of the box, and agree that this is good to have. My only concern is performance, and I'd like to think over how best to make this enabled via a switch, I'm leaning towards something like:

* configure logging = { pretty: true }

Hello Thomas,

Yes, leave it off by default but allowing the user the possibility to enable it would be a nice idea.

Best,

Neill

Hello, is there any movement on this? Would definitely be a nice feature in those cases where the response bodies are huge

implemented in develop.

* configure logPrettyResponse = true

Also can be set globally in karate-config.js

karate.configure('logPrettyResponse', true);

There is also a logPrettyRequest property that can be configured similarly.

Would be great if you can test this.

released 0.4.1

Hi Peter, currently Im only able to 'prettify' json requests/responses for calls directly from the main feature file. Is there a way to make it prettify request/response jsons when from called feature files also?

@sd-bnguyen you can if you do a configure within those files as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IsaoTakahashi picture IsaoTakahashi  路  3Comments

bAmrish picture bAmrish  路  3Comments

animomo1 picture animomo1  路  3Comments

hascode picture hascode  路  3Comments

bbchristians picture bbchristians  路  4Comments