Open Nezteb opened 1 year ago
Or an option to dump the responses into folders under a subpath. It would also help when writing tests and creating assertions.
[Option]
responses-path: ./out/runs
write-responses: true
Although using the curl output is very useful. :-)
Hi @chrisguest75, unless I've mistaken your point, you can do this with --output
:
GET https://foo.com
[Options]
output: response.bin
HTTP 200
Thanks, that does work for me @jcamiel. I had to update to 4.3.0 first though. Didn't realise I was using an older version.
Problem to solve
By default it seems that any JSON printed by
hurl
is not pretty-printed. Sometimes when I'm developing/debugging an API, I like to inspect the resulting JSON, which isn't doable inhurl
without external tools.This same feature request could also apply to HTML and XML, but at least for my use-case I am only asking for JSON. 😅
Proposal
Kind of similar to https://github.com/Orange-OpenSource/hurl/issues/1745, but I'd suggest either a CLI flag for this and/or a
[Option]
property to enable pretty printing for either an entire.hurl
file or a single request.Something like:
and/or:
Additional context and resources
I currently pipe my
hurl
commands tojq
to get the pretty-printed version of the JSON: https://github.com/jqlang/jqHowever, this only works if I'm only printing a single response body; otherwise the printed output isn't valid JSON.